Subject | Re: [IBO] Difference Plan Generated |
---|---|
Author | Svein Erling Tysvaer |
Post date | 2002-12-16T09:44:16Z |
Bayu,
are you sure you use "where nomor like '1234' "? To me it seems like you
use "where nomor like :test", which is very different.
Why this is different? Well, with LIKE you can use wildcards and if you use
wildcards you cannot use any index. The plan is determined when you prepare
your query, so at the time of prepare Firebird doesn't know that it can use
an index.
If you want to use an index on parameters, avoid LIKE. Often, STARTING is a
better option.
HTH,
Set
are you sure you use "where nomor like '1234' "? To me it seems like you
use "where nomor like :test", which is very different.
Why this is different? Well, with LIKE you can use wildcards and if you use
wildcards you cannot use any index. The plan is determined when you prepare
your query, so at the time of prepare Firebird doesn't know that it can use
an index.
If you want to use an index on parameters, avoid LIKE. Often, STARTING is a
better option.
HTH,
Set
>I just try simple query on my program like
>
>Select * from dn_Header
> where nomor like '1234'
>
>PLAN (DN_HEADER NATURAL)
>
>PARAMS = [ Version 1 SQLd 1 SQLn 1
> [TEST] = '1234' ]
>----*/
>
>Then i execute from IB Workbench or EMS QuickDesk
>
>the plan resulted is
>
>PLAN (DN_HEADER INDEX (DN_HEADER_NOMOR))
>
>
>Why query with like options in my program not using dn_header_nomor indexes
>?