Recreating indexes and adding constraints

Presuming you dropped indexes and constraints before loading data in, you'll now need to create them again. Index rebuild in particular can be very processor, memory, and disk intensive. If you have a large disk array, it's quite reasonable to consider running two or more such rebuilds in parallel. It's recommended that you have high values for shared_buffers, max_wal_size , checkpoint_timeout, and maintenance_work_mem to make indexing and constraint checking perform well.

Get PostgreSQL 10 High Performance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.