mla12 has asked for the wisdom of the Perl Monks concerning the following question:
We had a case recently where a database view (PostgreSQL) was "optimized." And in fact, it made quite a bit of difference in the normal case. But in one particular situation, the planner ended up with a much worse plan. We didn't catch the problem until it was in production.
Is there any way to keep track of the planner statistics (in development environments) and raise an assertion if the plan cost exceeds some specified threshold?
IOW, if we know a query plan cost has an upper limit of, say, 37033 normally, I'd like to be alerted if that planner result changes materially (e.g., if the cost jumps to 60k).
I'm looking for an approach that's largely automatic, so we don't need to run "EXPLAIN" queries manually. I'm familiar with DBI's trace stuff, but I didn't see anything there that would help with this.
Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBI and keeping track of planner statistics
by erix (Prior) on Jan 03, 2017 at 21:45 UTC | |
|
Re: DBI and keeping track of planner statistics
by Anonymous Monk on Jan 08, 2017 at 21:00 UTC |