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
Chat Icon