Thread: EXPLAIN via jdbc
Hi, we are currently evaluating postgres for a commercial project. To get a clue about how well the jdbc driver works for us, I wrote a simple java app that can display query results. Then I tried to add EXPLAIN support to it, so I could see the result of EXPLAIN SELECT * ... simultaniously. That is when I got stuck. I can't find a way to get the result from EXPLAIN queries through jdbc. I first tried to do it by executeQuery("EXPLAIN ..."), but that would not return a result set. Also using execute() helped, not even getWarnings() helped.. I there any way to get the result from an EXPLAIN query? Any help would be appreciated! Michael -- Michael Paesold, Austria/Europe
Michael Paesold wrote: > Hi, > > we are currently evaluating postgres for a commercial project. To get a clue > about how well the jdbc driver works for us, I wrote a simple java app that > can display query results. > Then I tried to add EXPLAIN support to it, so I could see the result of > EXPLAIN SELECT * ... simultaniously. That is when I got stuck. > > I can't find a way to get the result from EXPLAIN queries through jdbc. I > first tried to do it by executeQuery("EXPLAIN ..."), but that would not > return a result set. Also using execute() helped, not even getWarnings() > helped.. > > I there any way to get the result from an EXPLAIN query? If I read the development documentation correctly, the next version of PostgreSQL will return EXPLAIN output as a recordset instead of a NOTICE. HTH, Jochem
Jochem van Dieten wrote: > Michael Paesold wrote: [snip] > > I there any way to get the result from an EXPLAIN query? > > If I read the development documentation correctly, the next version of > PostgreSQL will return EXPLAIN output as a recordset instead of a NOTICE. > > HTH, > Jochem So that means that I have to wait. Is it not possible to fetch the NOTICEs? Returning a result set seems to be more standard, the other dbs I tried recently (MySQL, SAP DB) do so. Thanks anyway. Regards, Michael
The notices should be in the warnings, you may need to use the development version of the driver for this to be true. Dave On Thu, 2002-08-08 at 09:15, Jochem van Dieten wrote: > Michael Paesold wrote: > > Hi, > > > > we are currently evaluating postgres for a commercial project. To get a clue > > about how well the jdbc driver works for us, I wrote a simple java app that > > can display query results. > > Then I tried to add EXPLAIN support to it, so I could see the result of > > EXPLAIN SELECT * ... simultaniously. That is when I got stuck. > > > > I can't find a way to get the result from EXPLAIN queries through jdbc. I > > first tried to do it by executeQuery("EXPLAIN ..."), but that would not > > return a result set. Also using execute() helped, not even getWarnings() > > helped.. > > > > I there any way to get the result from an EXPLAIN query? > > If I read the development documentation correctly, the next version of > PostgreSQL will return EXPLAIN output as a recordset instead of a NOTICE. > > HTH, > Jochem > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > >
Dave Cramer wrote: > The notices should be in the warnings, you may need to use the > development version of the driver for this to be true. > > Dave > On Thu, 2002-08-08 at 09:15, Jochem van Dieten wrote: > > Michael Paesold wrote: [snip] > > > I there any way to get the result from an EXPLAIN query? > > > > If I read the development documentation correctly, the next version of > > PostgreSQL will return EXPLAIN output as a recordset instead of a NOTICE. > > > > HTH, > > Jochem I tried to use devpgjdbc2.jar (7.3dev (built 2002-07-16)). I still don't get the explain notices in getWarnings(). Regrettably I don't have the time to look into the code right now. Regards, Michael
I just tried a 7.2.1 backend with the same code, and the notices come back in the warning??? dave On Mon, 2002-08-12 at 10:27, Michael Paesold wrote: > Dave Cramer wrote: > > > The notices should be in the warnings, you may need to use the > > development version of the driver for this to be true. > > > > Dave > > On Thu, 2002-08-08 at 09:15, Jochem van Dieten wrote: > > > Michael Paesold wrote: > [snip] > > > > I there any way to get the result from an EXPLAIN query? > > > > > > If I read the development documentation correctly, the next version of > > > PostgreSQL will return EXPLAIN output as a recordset instead of a > NOTICE. > > > > > > HTH, > > > Jochem > > I tried to use devpgjdbc2.jar (7.3dev (built 2002-07-16)). I still don't get > the explain notices in getWarnings(). Regrettably I don't have the time to > look into the code right now. > > Regards, > Michael > > >
Dave Cramer wrote: > I just tried a 7.2.1 backend with the same code, and the notices come > back in the warning??? > > dave > On Mon, 2002-08-12 at 10:27, Michael Paesold wrote: > > Dave Cramer wrote: > > > > > The notices should be in the warnings, you may need to use the > > > development version of the driver for this to be true. > > > > > > Dave > > > On Thu, 2002-08-08 at 09:15, Jochem van Dieten wrote: > > > > Michael Paesold wrote: > > [snip] > > > > > I there any way to get the result from an EXPLAIN query? > > > > > > > > If I read the development documentation correctly, the next version of > > > > PostgreSQL will return EXPLAIN output as a recordset instead of a > > NOTICE. > > > > > > > > HTH, > > > > Jochem > > > > I tried to use devpgjdbc2.jar (7.3dev (built 2002-07-16)). I still don't get > > the explain notices in getWarnings(). Regrettably I don't have the time to > > look into the code right now. > > > > Regards, > > Michael I am sorry, that was my mistake. Thanks for your help Dave, reading your code I recognized that I had called Statement.getWarnings() instead of Connection.getWarnings(). Changing that helped. Thanks again! Michael