On 6/17/13 8:51 AM, Knut Anders Hatlen wrote:
Rick Hillegas<[email protected]>  writes:

I would like to use the PlanExporter tool to view a query plan in xml.
But I am having a hard time figuring out how to use this tool. The
documentation on PlanExporter is divided between a couple user guides,
and somehow, flipping back and forth between them, I have managed to
not understand how to operate the tool. Here is my attempt to get
xplain-style statistics for a query. As you can see, I can't locate
the stmt_id:

ij version 10.11
ij>  connect 'jdbc:derby:db;create=true';
ij>  call syscs_util.syscs_set_runtimestatistics(1);
0 rows inserted/updated/deleted
ij>  call syscs_util.syscs_set_xplain_schema('MY_STATS');
0 rows inserted/updated/deleted
ij>  select tablename from sys.systables where 1=2 order by tablename;
Does it work as expected if you remove the 1=2 predicate?
Aha. Yes, I get a statement id if I omit that predicate.

Thanks!
-Rick
The recording of the statistics happens in the close() method of the
top-level result set (see NoPutResultSetImpl.close()). If the top-level
result set is a ProjectRestrictResultSet, and there is a predicate that
is known at compile time to evaluate to false, it seems to take a
shortcut so that NoPutResultSetImpl.close() is not invoked:

     /* Nothing to do if open was short circuited by false constant expression 
*/
     if (shortCircuitOpen)
     {
             isOpen = false;
             shortCircuitOpen = false;
             source.close();
             return;
     }

Notice that it doesn't call super.close() in this case. I suspect that
this is what's causing the issue you're seeing.




Reply via email to