Index Build
Maintenance Working Memory
The default Postgres maintenance_work_mem
value of 64MB
is quite conservative and can slow down parallel index builds. We recommend at least 64MB
per
parallel worker.
Each worker is required to have at least 15MB
memory. If maintenance_work_mem
is set too low, an error will be returned.
Parallel Indexing Workers
ParadeDB uses Postgres’ max_parallel_maintenance_workers
setting to determine the degree of parallelism during CREATE INDEX
/REINDEX
. Postgres’ default is 2
, which may be too low for large tables.
In order for max_parallel_maintenance_workers
to take effect, it must be less than or equal to both max_parallel_workers
and max_worker_processes
.
Target Segment Count
By default, CREATE INDEX
/REINDEX
will create as many segments as there are CPUs on the host machine. This can be changed with
paradedb.target_segment_count
.
For optimal performance, the segment count should equal the number of parallel workers that a query can receive, which is controlled by
max_parallel_workers_per_gather
. If max_parallel_workers_per_gather
is greater than the number of CPUs on the host machine, then increasing the target segment count to match max_parallel_workers_per_gather
can improve query
performance.