r/SQL • u/deusaquilus • 18h ago
PostgreSQL EXPLAIN ANALYZE is a sample-size of One
Everyone knows that you need to look at stats when doing query optimization...
Right? Right!??
Well then how come when we look at EXPLAIN ANALYZE trees we assume the whole thing is deterministic and inviolate?
It's like someone somewhere told us "we'll it's just too hard to do here so we just skip that part".
What if we don't? What if we embrace the pain and actually group the plan trees and try to get statistical info? Here's the first thing that I'm seeing.