Why Won't PostgreSQL Use My Covering Index?
Dear Postgres, Why won’t you use my covering index?
Lately I’ve been learning to tune queries running against PostgreSQL, and it’s …
Read Moreon • 3 min read
SQLPass unfortunately can’t last forever, but happily it’s still going strong. Here’s some highlights from my Day #2.

I took a lot of notes in the session, this is my favorite excerpt from my notes:
One of my favorite pieces of information on day 2 was in Ben Nevarez’s talk on how the query optimizer works. He mentioned this DMV, which I hadn’t used before yesterday:
Sys.dm_exec_query_optimizer_info ←Check me out!
The other useful bit of info is that the timeout flag is recorded in the xml for the sql plans, so plans which the optimizer finds so complicated that it times out on compilation can be queried from the cache!
SQLPASS homework assignment: Write and test this query, determine how to automate running it and collecting the information.
This sample from BOL to find excessive compiles/recompiles:
select *
from sys.dm_exec_query_optimizer_info
where counter = 'optimizations'
or counter = 'elapsed time'
Ben Nevarez on the Phases of Query Optimization
Conor Cunningham’s Blog on sys.dm_exec_query_optimizer_info– excerpt:
The other use of the DMV is to get a good statistical picture of a running system. Say that I’m a DBA and I want to know how many queries in my application have hints or need hints to work well. Well, this will tell you. Granted, it doesn’t separate recompiles from compiles, and if you have a system where plans are getting kicked out of the cache things may be a bit skewed, but I can tell you that this is far better than simply guessing. Often the DB application developer doesn’t realize that they’ve built an application that requires a lot of hinting or a lot of compilations, and you can see this in more detail than you get with the performance counters"
Copyright (c) 2025, Catalyze SQL, LLC; all rights reserved. Opinions expressed on this site are solely those of Kendra Little of Catalyze SQL, LLC. Content policy: Short excerpts of blog posts (3 sentences) may be republished, but longer excerpts and artwork cannot be shared without explicit permission.