|Subject||Re: need your advise to optimize an easy query|
> Unfortunately Firebird does not (yet?) have range statistics (or histograms) on indices (ie: selectivity statistics on ranges instead of the whole index). Maybe using a compound index on (locationid, beds) or (beds, locationid) instead of separate indices on locationid and beds could improve things.by curiosity does Mysql or oracle have range statistics ?
Using a compound index is good, but how you do with
query like locationid= 'xxx' beds > 5 and beds < 9 and price > 1000000 and price < 2000000 order by date desc
you will need an index on
on LocationID, beds, price, date
(because of the order by). and as beds and price are not = in the where (but > or <) we can not use such index !
> Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 -
> sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser