🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: optimizing query ..

#637
From: Wayne Niddery [TeamB]
Date: Mon, 17 Sep 2007 14:28
27 lines
1950 bytes
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'.

-- 
Wayne Niddery - Winwright, Inc (www.winwright.ca)
"At the apex of every great tragedy of mankind there stands the figure
of an incorruptible altruist." - Ayn Rand 
Technical Details
Message-ID: <46ee8f07@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news.germany.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <46ea51f5$1@newsgroups.borland.com> <46ea9edd$1@newsgroups.borland.com> <46ee4c91$1@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-7-bit
Reply-To: "Wayne Niddery [TeamB]" <wniddery@chaffaci.on.ca>
From: "Wayne Niddery [TeamB]" <wniddery@chaffaci.on.ca>
Newsgroups: borland.public.interbase.sql
References: <46ea51f5$1@newsgroups.borland.com> <46ea9edd$1@newsgroups.borland.com> <46ee4c91$1@newsgroups.borland.com>
Subject: Re: optimizing query ..
Date: Mon, 17 Sep 2007 10:28:22 -0400
Lines: 29
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: 69.17.170.228
Message-ID: <46ee8f07@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1190039303 69.17.170.228 (17 Sep 2007 07:28:23 -0700)
X-Authenticated-User: wniddery
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news.germany.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail