Conceptual
Login

Turn enable_seqscan Off as a Diagnostic, Never as a Fix

Setting enable_seqscan = off in your session does not forbid sequential scans; it adds a huge penalty to them so that the planner will show you its next-best plan. Comparing the two plans answers one specific question: did the planner avoid the index because it thought the index was slower, or because it could not use it at all? That answer sends you to a statistics fix or a cost-setting fix — but leaving the switch off in production is how you get a much worse plan on some other query.

Questions this Concept answers

  • Why is the plan you get with the switch off a diagnostic rather than a fix?