🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Store Procedure and IN

#286
From: Karol Bieniaszewski
Date: Thu, 21 Feb 2008 09:39
63 lines
2590 bytes
then try exists clause

Select *
From MyStoreProcedure MSP
Where MSP.foo1 = MSP.foo2
and MSP.foo3 = MSP.foo4
and MSP.foo5 = MSP.foo6
or exists(SELECT * FROM MyTable MT where MT.ID=MSP.ID AND MT.f1=MT.f2)

Karol Bieniaszewski



U�ytkownik "Safwan" <safwan_maswadeh@yahoo.com> napisa� w wiadomo�ci 
news:47bd3ecc$1@newsgroups.borland.com...
> Thanks Karol Bieniaszewski
>
> But I use OR, so inner join will not give me the wanted result.
>
> ....
> or ID in (Select ID From MyTable Where f1 = f2);
>
>
>
> "Karol Bieniaszewski" <liviuslivius@poczta.onet.pl> wrote in message 
> news:47bd39ef$1@newsgroups.borland.com...
>>
>> U�ytkownik "Safwan" <safwan_maswadeh@yahoo.com> napisa� w wiadomo�ci 
>> 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 ??
>>>
>> change in (select ..
>> to inner join
>>
>> Karol Bieniaszewski
>>
>>
>
> 
Technical Details
Message-ID: <47bd4554@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!news2.arglkargh.de!feeder.erje.net!newsfeeder.dynfx.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <47bcbe87@newsgroups.borland.com> <47bd39ef$1@newsgroups.borland.com> <47bd3ecc$1@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
From: "Karol Bieniaszewski" <liviuslivius@poczta.onet.pl>
Newsgroups: borland.public.interbase.sql
References: <47bcbe87@newsgroups.borland.com> <47bd39ef$1@newsgroups.borland.com> <47bd3ecc$1@newsgroups.borland.com>
Subject: Re: Store Procedure and IN
Date: Thu, 21 Feb 2008 10:39:19 +0100
Lines: 65
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
NNTP-Posting-Host: 195.205.151.58
Message-ID: <47bd4554@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1203586388 195.205.151.58 (21 Feb 2008 01:33:08 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!news2.arglkargh.de!feeder.erje.net!newsfeeder.dynfx.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail