Subject | Union and Order by optimization |
---|---|
Author | svanderclock |
Post date | 2009-12-06T11:12:48Z |
hello,
following my previous thread i have
BIGTABLE (8 000 000 rows)
FieldA
FieldB
and one index fieldAFieldB on (fieldA, FieldB)
this select work great :
select first 10 skip 0 * from BIGTABLE where
FieldA = xxx and
fieldB = yyy
order by FieldA,
FieldB
PLAN (BIGTABLE ORDER fieldAFieldB)
result in < 8 ms
but now i m facing another problem because i need to do :
select first 10 skip 0 * from BIGTABLE where
(FieldA = xxx OR FieldA = www) and
fieldB = yyy
order by FieldA,
FieldB
PLAN (BIGTABLE ORDER fieldAFieldB)
result given in 1000 ms...
not work very effeciently :(
how to increase the speed of this query ?
using union probably ? but union seam to no work better :(
thanks for you help !!
stephane
following my previous thread i have
BIGTABLE (8 000 000 rows)
FieldA
FieldB
and one index fieldAFieldB on (fieldA, FieldB)
this select work great :
select first 10 skip 0 * from BIGTABLE where
FieldA = xxx and
fieldB = yyy
order by FieldA,
FieldB
PLAN (BIGTABLE ORDER fieldAFieldB)
result in < 8 ms
but now i m facing another problem because i need to do :
select first 10 skip 0 * from BIGTABLE where
(FieldA = xxx OR FieldA = www) and
fieldB = yyy
order by FieldA,
FieldB
PLAN (BIGTABLE ORDER fieldAFieldB)
result given in 1000 ms...
not work very effeciently :(
how to increase the speed of this query ?
using union probably ? but union seam to no work better :(
thanks for you help !!
stephane