Subject RE: [firebird-support] Retrieve query plan with SQL?
Author RB Smissaert
Thanks, I use the Firebird ODBC driver and will try that route.
I am interested to retrieve the plan in my application (actually it could be
done after running the select statement) as my queries are very variable and
user defined and I would like to log the plan to see and show the user why
a particular query was slow. In the same application I use SQLite and with
that it is simple to get the query plan.

RBS


-----Original Message-----
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Helen Borrie
Sent: 25 October 2007 12:40
To: firebird-support@yahoogroups.com
Subject: RE: [firebird-support] Retrieve query plan with SQL?

At 09:05 PM 25/10/2007, you wrote:
>I connect via ODBC with the standard Firebird ODBC driver.
>
>I know I can get the query plan with FlameRobin (didnt know IB_SQL worked
>with FB as well), but I would like to get it programmatically in VB.

For this, you would need an API translation of ibase.h and iberror.h for VB.
I have never heard of anyone having done one.

A select statement is prepared before execution and the plan is returned to
the client as a member of the statement parameter block. VB users use the
Firebird ODBC or Firebird ADO.Net drivers. Either of these drivers should
have a property you can read after the prepare to know what plan the
optimizer will use. Ask on the relevant lists if you can't find it in the
documentation for these drivers. We don't do driver support on this list.

What is your purpose in trying to get the plan into a user application?

./heLen


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://www.firebirdsql.org and click the Resources item
on the main (top) menu. Try Knowledgebase and FAQ links !

Also search the knowledgebases at http://www.ibphoenix.com

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Yahoo! Groups Links