Subject | Re: [firebird-support] Re: Optimize this simple SQL |
---|---|
Author | Vander Clock Stephane |
Post date | 2012-02-01T17:57:20Z |
Hello philippe,
not so easy to guess, the plan use randomly one of them ...
PLAN (HASH INDEX (HASH_IDX, HASH_IDX, HASH_IDX, HASH_IDX, HASH_IDX,
HASH_IDX, HASH_IDX, HASH_IDX, HASH_IDX, HASH_IDX, HASH_IDX, HASH_IDX,
HASH_IDX, HASH_IDX, HASH_IDX, HASH_IDX, HASH_IDX, HASH_IDX, HASH_IDX,
HASH_IDX, HASH_IDX, HASH_IDX, HASH_IDX, HASH_IDX, HASH_IDX, HASH_IDX,
HASH_IDX, HASH_IDX, HASH_IDX, HASH_IDX, HASH_IDX, HASH_X1_Y5_IDX))
replacing the last HASH_X1_Y5_IDX by HASH_X1_Y2_IDX or HASH_X1_Y3_IDX or
.. gave "around" the same result in speed
even replacing it by all the index at the same time : HASH_X1_Y1_IDX,
HASH_X1_Y2_IDX, HASH_X1_Y3_IDX, HASH_X1_Y4_IDX, HASH_X1_Y5_IDX
the speed stay around the same ...
also i not really understand why i need an index on
CREATE ASC INDEX HASH_IDX ON HASH (X1_Y1, X1_Y2, X1_Y3, X1_Y4, X1_Y5);
instead of just on CREATE ASC INDEX HASH_IDX ON HASH (X1_Y1, X1_Y2);
(ie: trying to understand
http://explainextended.com/2010/05/19/things-sql-needs-determining-range-cardinality/
)
thanks for all !
stéphane
not so easy to guess, the plan use randomly one of them ...
PLAN (HASH INDEX (HASH_IDX, HASH_IDX, HASH_IDX, HASH_IDX, HASH_IDX,
HASH_IDX, HASH_IDX, HASH_IDX, HASH_IDX, HASH_IDX, HASH_IDX, HASH_IDX,
HASH_IDX, HASH_IDX, HASH_IDX, HASH_IDX, HASH_IDX, HASH_IDX, HASH_IDX,
HASH_IDX, HASH_IDX, HASH_IDX, HASH_IDX, HASH_IDX, HASH_IDX, HASH_IDX,
HASH_IDX, HASH_IDX, HASH_IDX, HASH_IDX, HASH_IDX, HASH_X1_Y5_IDX))
replacing the last HASH_X1_Y5_IDX by HASH_X1_Y2_IDX or HASH_X1_Y3_IDX or
.. gave "around" the same result in speed
even replacing it by all the index at the same time : HASH_X1_Y1_IDX,
HASH_X1_Y2_IDX, HASH_X1_Y3_IDX, HASH_X1_Y4_IDX, HASH_X1_Y5_IDX
the speed stay around the same ...
also i not really understand why i need an index on
CREATE ASC INDEX HASH_IDX ON HASH (X1_Y1, X1_Y2, X1_Y3, X1_Y4, X1_Y5);
instead of just on CREATE ASC INDEX HASH_IDX ON HASH (X1_Y1, X1_Y2);
(ie: trying to understand
http://explainextended.com/2010/05/19/things-sql-needs-determining-range-cardinality/
)
thanks for all !
stéphane
On 2/1/2012 3:10 PM, philippe makowski wrote:
>
> Vander Clock Stephane [2012-01-31 16:30] :
> > now with this strategy i don't remenbered, but did i need to keep the
> > index
> > CREATE INDEX HASH_X1_Y1_IDX ON HASH (X1_Y1);
> > CREATE INDEX HASH_X1_Y2_IDX ON HASH (X1_Y2);
> > CREATE INDEX HASH_X1_Y3_IDX ON HASH (X1_Y3);
> > CREATE INDEX HASH_X1_Y4_IDX ON HASH (X1_Y4);
> > CREATE INDEX HASH_X1_Y5_IDX ON HASH (X1_Y5);
> >
> > or i can remove them ?
> watch the PLAN, and you'll have the answer I guess
>
>
[Non-text portions of this message have been removed]