Subject | Query doen't want to use index |
---|---|
Author | adiw_db |
Post date | 2005-01-17T19:02:47Z |
Hi, I have one table that contains 110.000 records.
I ran a query to this table :
select knokat from lib_judul where k245a like '%MATEMATIKA%'
But it doesn't use available indexes (both fields are indexed).
PLAN (LIB_JUDUL NATURAL)
It took almost 14 seconds to finish.
If I changed the query :
select knokat from lib_judul where k245a like 'MATEMATIKA'
or
select knokat from lib_judul where k245a = 'MATEMATIKA'
It used index, and finished less than a second.
PLAN (LIB_JUDUL INDEX (IDX_LIB_JUDUL_K245A))
I tried at FB1.0 on linux and FB1.5 on WinXP Pro.
Can someone explain to me how to use index?
Thank you.
Adi.
I ran a query to this table :
select knokat from lib_judul where k245a like '%MATEMATIKA%'
But it doesn't use available indexes (both fields are indexed).
PLAN (LIB_JUDUL NATURAL)
It took almost 14 seconds to finish.
If I changed the query :
select knokat from lib_judul where k245a like 'MATEMATIKA'
or
select knokat from lib_judul where k245a = 'MATEMATIKA'
It used index, and finished less than a second.
PLAN (LIB_JUDUL INDEX (IDX_LIB_JUDUL_K245A))
I tried at FB1.0 on linux and FB1.5 on WinXP Pro.
Can someone explain to me how to use index?
Thank you.
Adi.