top | item 40196946

(no title)

keeperofdakeys | 1 year ago

Either put machinery in your schema migration tool to create indexes as a separate step, so they are easy to re-apply. This makes keeping indexes in sync between production and staging a lot easier. Or you can use "CREATE TABLE_B (LIKE TABLE_A WITH INDEXES);".

discuss

order

kroolik|1 year ago

Make sure to create indices AFTER the data is in. Its way faster to create indices from data than create them empty and insert data.

Also make sure to set maintenance_work_mem high as it helps with index creation