🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #549

Re: retrieve query plan

#549
From: Quinn Wildman (CodeGear Develope...
Date: Wed, 19 Sep 2007 20:13
42 lines
2417 bytes
Here is how to do it with isql:

1. Connect to database with isql
2. set plan on;
3. execute your query

If your query returns many records, it's advisable to replace a field 
list with count(*) so you won't be distracted with output. Either way, 
the plan is the same.

Note that this technique applies to all subsequent version of InterBase 
as well.

Using the API, call isc_dsql_sql_info() with the item 
isc_info_sql_get_plan to get a plan.

RB Smissaert wrote:
> How could I get access the API from VB?
> How would I do it with ISQL from the commandline?
> I might be able to use the last and direct the output to text and get 
> the plan from the text file.
> Using the API directly would be the best way.
> Thanks.
> 
> RBS
> 
> "Craig Stuntz [TeamB]" <craig_stuntz@nospam.please [a.k.a. acm.org]> 
> wrote in message news:46f17982$1@newsgroups.borland.com...
>> RB Smissaert wrote:
>>
>>> Is there a way in plain SQL to retrieve the Interbase query plan
>>> given a particular query?
>>
>> No. You need to use the API for this, either directly or with a
>> component set like IBX. You can also do it in command-line ISQL.
>>
>> -- 
>> Craig Stuntz [TeamB] � Vertex Systems Corp. � Columbus, OH
>>  Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
>> All the great TeamB service you've come to expect plus (New!)
>>  Irish Tin Whistle tips: http://learningtowhistle.blogspot.com 
> 
Technical Details
Message-ID: <46f18372$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <46f174bb$1@newsgroups.borland.com> <46f17982$1@newsgroups.borland.com> <46f17d33$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,c546675c5ab4ad6e
X-Google-Attributes: gid114a0e,public,usenet
X-Google-Language: ENGLISH,ASCII
Date: Wed, 19 Sep 2007 13:13:27 -0700
From: "Quinn Wildman (CodeGear Developer Support)" <qwildman@nospam.codegear.com>
User-Agent: Thunderbird 1.5.0.13 (Windows/20070809)
MIME-Version: 1.0
Newsgroups: borland.public.interbase.sql
Subject: Re: retrieve query plan
References: <46f174bb$1@newsgroups.borland.com> <46f17982$1@newsgroups.borland.com> <46f17d33$1@newsgroups.borland.com>
In-Reply-To: <46f17d33$1@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
NNTP-Posting-Host: 10.143.100.209
Message-ID: <46f18372$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1190232946 10.143.100.209 (19 Sep 2007 13:15:46 -0700)
Lines: 42
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail