Subject Re: [firebird-support] Re: need your advise to optimize an easy query
Author Mark Rotteveel
> by curiosity does Mysql or oracle have range statistics ?

Oracle does use histograms depending on the configuration of the statistics collection IIRC.

> 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 !

You don't necessarily need to use a full compound index. Firebird can use more than one index, so you don't have to use a single compound index, it is just that in some cases using a compound index is more efficient; if it actually is, depends on your situation.
--
Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser