You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by "Christopher L. Fleck" <cl...@bellsouth.net> on 2008/04/12 18:28:04 UTC

RE: Query Plans

I figured out what my problem is.  The query plan isn't displayed until you
close the statement.

-----Original Message-----
From: Christopher L. Fleck [mailto:clfleck@bellsouth.net] 
Sent: Wednesday, November 28, 2007 3:14 PM
To: 'Derby Discussion'
Subject: RE: Query Plans

Is this not sufficient:

private static void printResultSet(ResultSet results) {
	try { 
		while(results.next()) {
			for(int i = 1; 
			i <= results.getMetaData().getColumnCount(); 
			i++) {
				System.out.print(results.getString(i) +
"\t");
			}
			System.out.println();
		}
	} catch(SQLException e) { e.printStackTrace(); }
}

Also, I'm not sure if that would explain why I sometimes get the query plan
but not always.  With the same query, the query plan may show up or it may
not.  

Thank you for responding,
CLF

-----Original Message-----
From: Bryan Pendleton [mailto:bpendleton@amberpoint.com] 
Sent: Wednesday, November 28, 2007 3:07 PM
To: Derby Discussion
Subject: Re: Query Plans

> I've got query plan logging enabled in Derby, but, for some reason, I 
> only see query plans for my selects seemingly at random. 

Make sure you're fully retrieving all the rows from the result set.
I think I remember that query plan logging only occurs at the completion
of execution, after all the rows have been fully fetched.

thanks,

bryan