May 2018
Intermediate to advanced
576 pages
30h 25m
English
Setting the enable_seqscan parameter to off, we greatly increase the cost of sequential scans for the query. This setting is never recommended for production use, only for testing.
This allows us to generate two different plans, one with a SeqScan and one without. The optimizer works by selecting the lowest cost option available. In this case, the cost of the SeqScan is 188.75 and the cost of the IndexScan is 323.25, so for this specific case, the IndexScan will not be used.
Remember that each case is different, and always relates to the exact data distribution.