4 ms·
This is a valid concern, I've seen simple automatic optimizations backfire before. An example I remember from MS Sql Server (older versions) of a very simple op
by flukus 9y ago
This is a valid concern, I've seen simple automatic optimizations backfire before. An example I remember from MS Sql Server (older versions) of a very simple optimization of using indexes can backfire with the dynamic filter pattern:
where ((@foo is null) or (foo = @foo))
and ((@bar is null) or (bar = @bar))
Depending on statistics, order of execution, indexes in place and phase of the moon this could produce fast results or have to revert to a full table scan (because it uses a cached query plan with the wrong index).
Devs still have some awareness of how queries translate to actual running instructions and to measure that the results are in line with what is expected.
- mst 9y agoModern pg libraries only cache the plan with the query params involved as well so this generally doesn't happen. (I made it happen with an older version of things and ... yes, argh)