postgresql_16:3.11.4.5 Increase maintenance_work_mem
PostgreSQL 16 > The SQL Language > Performance Tips > Populating a Database > Increase maintenance_work_mem
Temporarily increasing the (see guc-maintenance-work-mem) configuration variable when loading large amounts of data can lead to improved performance. This will help to speed up CREATE INDEX commands and ALTER TABLE ADD FOREIGN KEY commands. It won't do much for COPY itself, so this advice is only useful when you are using one or both of the above techniques.