Thread: Using EXPLAIN in regressions?
Is it safe to use the output of EXPLAIN in regression tests? I want to make sure that certain GiST indexes are being used by sample queries, but I am not sure if it is safe to rely on the format of EXPLAIN to be unchanging. Thoughts? Josh Reich
Joshua Reich <josh@root.net> writes: > Is it safe to use the output of EXPLAIN in regression tests? No, not unless you want the test to break every other week. > I want to > make sure that certain GiST indexes are being used by sample queries, About the best bet is to make sure that's the *only* available index, and set enable_seqscan = off to be sure. In some cases, you can use the ordering of the returned rows as a proxy --- if they're returned in something other than heap order then it must have used an index. I'm not sure if this will be a stable answer for GIST indexes though. regards, tom lane
On Thu, 2006-07-20 at 18:19 -0400, Tom Lane wrote: > About the best bet is to make sure that's the *only* available index, > and set enable_seqscan = off to be sure. Another approach would be to define a UDF that takes a query string, runs the parser, rewriter, and planner on the string and then checks various properties of the resulting Plan (e.g. that it includes a GiST index scan). -Neil