🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: performance

#813
From: Svein Erling Tysvær
Date: Thu, 10 May 2007 22:00
54 lines
2514 bytes
OK, I'll guess - try to remove the use of the id_gestuine index like 
this (assuming that is the least selective index):

select
    sum(stoc_temporar.stoc) as stoc,
    produse.denumire
from produse
   inner join stoc_temporar on (stoc_temporar.id_produs=produse.id_produs)
where
    produse.id_sortiment=3 and
    stoc_temporar.id_gestiune+0=1
group by
       produse.denumire
order by
       produse.denumire

HTH,
Set

Tiberiu Horvath wrote:
> I have the following query, that takes 6..8 seconds on a large (4000 records 
> in stoc_temporar) database. Is there a way to speed up this ?
> 
> 
> Thank you in advance,
> 
> Tiberiu
> 
> 
> select
>    sum(stoc_temporar.stoc) as stoc,
>    produse.denumire
> from produse
>   inner join stoc_temporar on (stoc_temporar.id_produs=produse.id_produs)
> where
>    produse.id_sortiment=3 and
>    stoc_temporar.id_gestiune=1
> group by
>       produse.denumire
> order by
>       produse.denumire
> 
> 
> PLAN JOIN (PRODUSE ORDER DENUMIRE_IDX INDEX (FK_PRODUSE_REFERENCE_SORTIMEN), 
> STOC_TEMPORAR INDEX (FK_STOC_TEM_REFERENCE_PRODUSE, 
> FK_STOC_TEM_REFERENCE_GESTIUNE)):
> PLAN JOIN (PRODUSE ORDER DENUMIRE_IDX INDEX (FK_PRODUSE_REFERENCE_SORTIMEN), 
> STOC_TEMPORAR INDEX (FK_STOC_TEM_REFERENCE_PRODUSE, 
> FK_STOC_TEM_REFERENCE_GESTIUNE))
> 
> Adapted plan:
> PLAN JOIN (PRODUSE ORDER DENUMIRE_IDX INDEX (FK_PRODUSE_REFERENCE_SORTIMEN), 
> STOC_TEMPORAR INDEX (FK_STOC_TEM_REFERENCE_PRODUSE, 
> FK_STOC_TEM_REFERENCE_GESTIUNE))
Technical Details
Message-ID: <46439619$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <464355cc@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,65a795d106dce3a2
X-Google-Attributes: gid114a0e,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Fri, 11 May 2007 00:00:59 +0200
From: Svein Erling Tysvær
 <svein.erling.tysvaer@kreftregisteret.no>
User-Agent: Thunderbird 1.5.0.10 (Windows/20070221)
MIME-Version: 1.0
Newsgroups: borland.public.interbase.sql
Subject: Re: performance 
References: <464355cc@newsgroups.borland.com>
In-Reply-To: <464355cc@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Antivirus: avast! (VPS 000739-1, 10.05.2007), Outbound message
X-Antivirus-Status: Clean
NNTP-Posting-Host: 80.203.64.24
Message-ID: <46439619$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1178834457 80.203.64.24 (10 May 2007 15:00:57 -0700)
Lines: 54
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail