Subject | Re: PLAN |
---|---|
Author | Svein Erling |
Post date | 2004-05-11T13:52:53Z |
Hi again, Rafael!
GROUP BY forces fetching everything, whereas without any GROUP BY or
DISTINCT that is not neccessary. So check how long time each query
takes to fetch the entire result set.
used. I assume PK_BS_TRM is unique, so that is a good index. But what
about FK_BS_IDX_COD_GRP and BS_IDX_COD_BASE_IDX, are they selective or
does most of the records match your comparison? How big are your
tables anyway?
**************************************************************
*** Set ***
*** ***
*** What? Are you still not a member of the Firebird ***
*** Foundation? Hurry, or else you cannot boast about your ***
*** membership at the Fulda conference! ***
*** Join today at http://www.firebirdsql.org/ff/foundation ***
**************************************************************
> The Feribird plan for this select is:30 ms? Is that for returning all records or just a few records? Using
>
> PLAN SORT (JOIN (I INDEX (FK_BS_IDX_COD_GRP,BS_IDX_COD_BASE_IDX),T
> INDEX (PK_BS_TRM)))
>
> This select takes 23.294,00 ms to execute with GROUP BY T.TRM clause
> and 30,00 ms without GROUP BY TRM clause. So, I'm trying to do
> Firebird to use BS_TRM_TRM_IDX for T.TRM column too. I'm trying the
> following plan:
GROUP BY forces fetching everything, whereas without any GROUP BY or
DISTINCT that is not neccessary. So check how long time each query
takes to fetch the entire result set.
> PLAN JOIN( T ORDER BS_TRM_TRM_IDX, T INDEX (PK_BS_TRM), I INDEXTo speed things up, I'd rather check the selectivity for the indexes
> (FK_BS_IDX_COD_GRP))
used. I assume PK_BS_TRM is unique, so that is a good index. But what
about FK_BS_IDX_COD_GRP and BS_IDX_COD_BASE_IDX, are they selective or
does most of the records match your comparison? How big are your
tables anyway?
**************************************************************
*** Set ***
*** ***
*** What? Are you still not a member of the Firebird ***
*** Foundation? Hurry, or else you cannot boast about your ***
*** membership at the Fulda conference! ***
*** Join today at http://www.firebirdsql.org/ff/foundation ***
**************************************************************