Subject Re: [ib-support] query optimizing
Author Carlos H. Cantu
This query will not be optimized because the containing clause will not use
the index :-( If you want only the strees that begin with BRAM so you can
use STARTING WITH. Starting with will use the index and so will be much
faster.

[]s

Carlos
WarmBoot Informatica - http://www.warmboot.com.br
Interbase-BR - http://www.interbase-br.com

B> With the help from the ibobjects lists I created a database/table with about
B> 450.000 records with all street names in the Netherlands.

B> CREATE TABLE "POSTCODE"
B> (
B> "ID" INT64 NOT NULL,
B> "STREET" CHAR( 50) CHARACTER SET NONE,
B> "CITY" CHAR( 50) CHARACTER SET NONE,
B> "POSTCODE" CHAR( 7) CHARACTER SET NONE,
B> CONSTRAINT "PK_POSTCODE" PRIMARY KEY ("ID")
B> );

B> CREATE ASC INDEX "POSTCODE" ON "POSTCODE" ("POSTCODE");
B> CREATE ASC INDEX "STREET" ON "POSTCODE" ("STREET");

B> I created the following query :

B> SELECT STREET FROM POSTCODE WHERE STREET CONTAINING 'BRAM'

B> There are actually 130 streets in Holland containing my first name. But it
B> takes about 10/15 seconds before its returning the 130 rows with an IB_Query
B> set on active. Is there a way to check if the query is 100% optimized.

B> Could it go faster ?

B> Bram van der Voet / A&V Automatisering
B> bram@... <mailto:bram@...>
B> Glasbergenlaan 6
B> 2235 BP VALKENBURG ZH
B> tel 071 407 6956
B> fax 071 407 3939