How to configure PostgreSQL in such a way that it uses indexes

Unlike MySQL PostgreSQL often skips indexes and does (unwanted) full table scan.

I spent much time tuning PostgreSQL to make it use indexes. The following works for me:

enable_bitmapscan = off
#enable_hashagg = on
enable_hashjoin = off
enable_indexscan = on
enable_indexonlyscan = on
enable_material = off
enable_mergejoin = on
enable_nestloop = off
#enable_parallel_append = on
enable_seqscan = off
enable_sort = off
#enable_incremental_sort = on
#enable_tidscan = on
#enable_partitionwise_join = off
#enable_partitionwise_aggregate = off
#enable_parallel_hash = on
#enable_partition_pruning = on
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.