🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: optimizing query ..

#639
From: Karol Bieniaszewski
Date: Tue, 18 Sep 2007 12:54
34 lines
2013 bytes
U�ytkownik "Wayne Niddery [TeamB]" <wniddery@chaffaci.on.ca> napisa� w 
wiadomo�ci news:46ee8f07@newsgroups.borland.com...
> Karol Bieniaszewski wrote:
>>
>>> I would try this:
>>>
>>> FROM
>>> TABLE_C C
>>> INNER JOIN TABLE_A A ON A.ID=C.ID_OBJ
>>> INNER JOIN TABLE_B B ON B.ID_OBJ=C.ID_OBJ AND B.SYSTEM=C.SYSTEM
>>> LEFT JOIN TABLE_D D ON D.NAZWA=C.ALARM
>>> WHERE
>>> C.ZRODLO=:PARAM_X
>>> AND B.KOD=:PARAM_Y
>>> AND B.SYSTEM=:PARAM_Z
>>
>> now plan is :(
>> PLAN JOIN (JOIN (A NATURAL,C INDEX (IXA_TABLE_C__OBJ__ZRO__SYS),B
>> INDEX (IXA_TABLE_B__KOD__SYSTEM, FK_TABLE_B__ID_OBJ)),D INDEX
>> (IXAU__TABLE_D__NAZWA))
>
> You could try making A a left join. If there is always a match, the result 
> set will be the same, if there could be C's without a matching A then add 
> a condition to the where clause : ' A.ID is not null'.
>
> -- 


of course plan is

PLAN JOIN (JOIN (JOIN (B INDEX (IXA_TABLE_B__KOD__SYSTEM),A INDEX
(PK_TABLE_A__ID)),C INDEX (IXA_TABLE_C__OBJ__ZRO__SYS)),D INDEX
(IXAU__TABLE_D__NAZWA)) 
Technical Details
Message-ID: <46efc8f4$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <46ea51f5$1@newsgroups.borland.com> <46ea9edd$1@newsgroups.borland.com> <46ee4c91$1@newsgroups.borland.com> <46ee8f07@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,27cb88e47143e0c2
X-Google-Attributes: gid114a0e,public,usenet
X-Google-Language: ENGLISH,ASCII
From: "Karol Bieniaszewski" <liviuslivius@poczta.onet.pl>
Newsgroups: borland.public.interbase.sql
References: <46ea51f5$1@newsgroups.borland.com> <46ea9edd$1@newsgroups.borland.com> <46ee4c91$1@newsgroups.borland.com> <46ee8f07@newsgroups.borland.com>
Subject: Re: optimizing query ..
Date: Tue, 18 Sep 2007 14:54:18 +0200
Lines: 36
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 195.205.151.58
Message-ID: <46efc8f4$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1190119668 195.205.151.58 (18 Sep 2007 05:47:48 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail