🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Store Procedure and IN

#293
From: Safwan
Date: Sat, 23 Feb 2008 09:10
50 lines
2234 bytes
Thank you all

I solve it by using EXISTS instead of IN, that makes the speed acceptable.
I use the Interbase PLANalyzer for testing the store procedure plans and it 
give me a good result. but when using that procedure with IN, like my 
example, the IN statement doesn't use the any index and it make a full scan 
many times, but when using the -exists - it make only one full scan.

Select *
From MyStoreProcedure
Where foo1 = foo2
and foo3 = foo4
and foo5 = foo6
or EXISTS (Select ID From MyTable Where f1 = f2);

Bye.


"Safwan" <safwan_maswadeh@yahoo.com> wrote in message 
news:47bcbe87@newsgroups.borland.com...
> Hi
>
> Select *
> From MyView
> Where foo1 = foo2
> and foo3 = foo4
> and foo5 = foo6
> or ID in (Select ID From MyTable Where f1 = f2);
>
> With the above statement the speed is acceptable. But when changeing the 
> same view (MyView) into a store procedure with  - for select .... from ... 
> do suspend. - like this :
>
> Select *
> From MyStoreProcedure
> Where foo1 = foo2
> and foo3 = foo4
> and foo5 = foo6
> or ID in (Select ID From MyTable Where f1 = f2);
>
> The statement take a looooong time to fetch the records.
> I use the PLANalyzer to check the statement, I notice that the in clause 
> cause slow.
>
> What should I do to speed up my query ??
>
> Your's
> Safwan.
>
> 
Technical Details
Message-ID: <47bfe2f2@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newshub.sdsu.edu!news.linkpendium.com!news.linkpendium.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <47bcbe87@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,5e0810130fee05d6
X-Google-Attributes: gid114a0e,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Safwan" <safwan_maswadeh@yahoo.com>
Newsgroups: borland.public.interbase.sql
References: <47bcbe87@newsgroups.borland.com>
Subject: Re: Store Procedure and IN
Date: Sat, 23 Feb 2008 11:10:18 +0200
Lines: 52
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 213.6.70.59
Message-ID: <47bfe2f2@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1203757810 213.6.70.59 (23 Feb 2008 01:10:10 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newshub.sdsu.edu!news.linkpendium.com!news.linkpendium.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail