Subject | Re: [firebird-support] Performance problem... |
---|---|
Author | Aage Johansen |
Post date | 2005-01-20T20:15:05Z |
Jonathan Neve wrote:
index for the sort (order by).
for select f.date_fiche+0, fc.pieces_a, fc.heuredebut
order by 1 DESC, fc.heuredebut DESC
Aage J.
>You could try the two small changes below. The idea is to prevent using an
> The following procedure is very slow (about 13 seconds). I have found
> that removing an index on FICHES (DATE_FICHE) makes it go significantly
> faster (about 300 ms).
> ...
index for the sort (order by).
>Change to:
> CREATE PROCEDURE PR_FETCHPIECES_A (
> W_PRODUIT VARCHAR(50),
> W_DATE_FICHE DATE,
> W_HEUREDEBUT NUMERIC(15, 2)
> ) RETURNS (
> DATE_FICHE DATE,
> PIECES_A NUMERIC(15, 2),
> HEUREDEBUT NUMERIC(15, 2)
> ) AS
> declare variable lFirst char(1);
> begin
> lFirst = 'Y';
> for select f.date_fiche, fc.pieces_a, fc.heuredebut
for select f.date_fiche+0, fc.pieces_a, fc.heuredebut
> from fichescorps fcChange to:
> join fiches f on f.code = fc.code
> where fc.produit = :w_produit
> and (f.date_fiche < :w_date_fiche or ((f.date_fiche = :w_date_fiche) and
> (fc.heuredebut < :w_heuredebut)))
> order by f.date_fiche DESC, fc.heuredebut DESC
order by 1 DESC, fc.heuredebut DESC
> into :date_fiche, :pieces_a, :heuredebut--
> do begin
> if (lFirst = 'Y') then suspend;
> else exit;
> lFirst = 'N';
> end
> end
Aage J.