db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <knut.hat...@oracle.com>
Subject Re: how to use the PlanExporter tool
Date Mon, 17 Jun 2013 15:51:04 GMT
Rick Hillegas <rick.hillegas@oracle.com> 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?

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;

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

Knut Anders

View raw message