Subject | Re: Why the JOIN is soooo long? |
---|---|
Author | Svein Erling Tysvær |
Post date | 2005-06-06T18:18:17Z |
Hmm, I wonder what tool you are using, I've never seen that syntax
before. Assuming
ON "" & Cheque.IDCHEQUE= "" & RapportFiduciePart5.refNSF
translates to
ON '' || Cheque.IDCHEQUE = '' || RapportFiduciePart5.refNSF
you effectively prevents using indexes on IDCHEQUE and refNSF.
Preventing indexes from being used is sometimes a good option, but I'd
be happier if I knew why preventing those indexes helps, and to
understand that I need to see a PLAN. Please show us the PLAN Firebird
creates. Also, you say that RapportFiduciePart5 is a query, did you
mean view or stored procedure? Can you show us the source?
Set
before. Assuming
ON "" & Cheque.IDCHEQUE= "" & RapportFiduciePart5.refNSF
translates to
ON '' || Cheque.IDCHEQUE = '' || RapportFiduciePart5.refNSF
you effectively prevents using indexes on IDCHEQUE and refNSF.
Preventing indexes from being used is sometimes a good option, but I'd
be happier if I knew why preventing those indexes helps, and to
understand that I need to see a PLAN. Please show us the PLAN Firebird
creates. Also, you say that RapportFiduciePart5 is a query, did you
mean view or stored procedure? Can you show us the source?
Set
--- In firebird-support@yahoogroups.com, "mona yazbeck" wrote:
> Both fields are indexes.
>
> This query works fine on "text" field... And when I change my query
> for a INNER JOIN like this:
>
> INNER JOIN RapportFiduciePart5
> ON "" & Cheque.IDCHEQUE= "" & RapportFiduciePart5.refNSF;
>
> It's a lot faster! (But still about 20 seconds.... (better compared
> to an endless query)
>
> SELECT Cheque.DATEDEPOT, RapportFiduciePart5.IDGROUPE,
> RapportFiduciePart5.IDDOSSIER, RapportFiduciePart5.NOCHEQUE,
> RapportFiduciePart5.montantClient AS MontantTot,
> RapportFiduciePart5.chequeRemis, RapportFiduciePart5.nomComplet,
> RapportFiduciePart5.DATEDEPOT AS DateDuDepotDuCheque,
> RapportFiduciePart5.IDCHEQUE
> FROM Cheque
> INNER JOIN RapportFiduciePart5
> ON Cheque.IDCHEQUE= RapportFiduciePart5.refNSF;
>
> IDCHEQUE and refNSF are both INTEGER. When I do a similar query with
> One integer and one Text Field using "" & integer = text, it works
> great.
>
> RapportFiduciePart5 is a Query and alone, it runs pretty fast
> Cheque is a Table