Subject Re: Additional index kinds like R*Tree for Firebird
Author stephane
no, even with the ability of firebird to use multiple index, definitively it's not very efficient under Firebird !

for exemple the simple query on a millions rows table like select from tableA where fieldA > xxx (with off course an index on fieldA) can be very long (several second) !! btree index are not very efficient for query such as > or < ...

try to download this benchmark tool that i do
https://sourceforge.net/projects/alcinoe/files/alsqlbenchmark/1.00/

and compare by yourself the speed Firebird with Multiple Index VS Sqlite3 with Rtree index ! (try to fullfill the table with 10 000 000 rows) no competition at all, firebird with his multiple index can need more than 20 seconds to return where with the rtree index sqlite3 return in few ms !

don't forget that the rtree index of sqlite3 is a simple "trick" that consist in "denormalizing" the main table in 3 more tables !

stephane

--- In Firebird-Architect@yahoogroups.com, Adriano dos Santos Fernandes <adrianosf@...> wrote:
>
> On 08-01-2011 15:59, tempo93fr wrote:
> > --- In Firebird-Architect@yahoogroups.com, Dimitry Sibiryakov <sd@> > Could you provide examples of such queries, please?..
> > yes :
> > CREATE TABLE TABLEA(
> > ID INTEGER NOT NULL,
> > x1_y1 SMALLINT NOT NULL,
> > x1_y2 SMALLINT NOT NULL,
> > x1_y3 SMALLINT NOT NULL,
> > x1_y4 SMALLINT NOT NULL,
> > x1_y5 SMALLINT NOT NULL
> > PRIMARY KEY (ID)
> > );
> > Select
> > ID
> > from
> > TABLEA
> > where
> > x1_y1 >= <#randomnumber1> - 20 and
> > x1_y1 <= <#randomnumber1> + 20 and
> > x1_y2 >= <#randomnumber2> - 20 and
> > x1_y2 <= <#randomnumber2> + 20 and
> > x1_y3 >= <#randomnumber3> - 20 and
> > x1_y3 <= <#randomnumber3> + 20 and
> > x1_y4 >= <#randomnumber4> - 20 and
> > x1_y4 <= <#randomnumber4> + 20 and
> > x1_y5 >= <#randomnumber5> - 20 and
> > x1_y5 <= <#randomnumber5> + 20;
> >
> >
> What's the problem with this approach, as Firebird can use multiple
> indexes in a lookup?
>
> SQL> CREATE INDEX TABLEA_1 ON TABLEA (X1_Y1);
> SQL> CREATE INDEX TABLEA_2 ON TABLEA (X1_Y2);
> SQL> CREATE INDEX TABLEA_3 ON TABLEA (X1_Y3);
> SQL> CREATE INDEX TABLEA_4 ON TABLEA (X1_Y4);
> SQL> CREATE INDEX TABLEA_5 ON TABLEA (X1_Y5);
>
> Select
> ID
> from
> TABLEA
> where
> x1_y1 >= ? - 20 and
> x1_y1 <= ? + 20 and
> x1_y2 >= ? - 20 and
> x1_y2 <= ? + 20 and
> x1_y3 >= ? - 20 and
> x1_y3 <= ? + 20 and
> x1_y4 >= ? - 20 and
> x1_y4 <= ? + 20 and
> x1_y5 >= ? - 20 and
> x1_y5 <= ? + 20;
>
> PLAN (TABLEA INDEX (TABLEA_5, TABLEA_4, TABLEA_3, TABLEA_2, TABLEA_1))
>
>
> Adriano
>