Subject | Re: Can someone explain to me what's the best way to do this? |
---|---|
Author | GrumpyRain |
Post date | 2004-11-30T22:16:59Z |
I believe (and correct me if I am wrong) that the locate function on a
query component is processed by the application. That means that the
database will have to return all the records to the application, and
the component can then do a search for it. Even if the component does
use some form of binary search on the dataset, you have already paid a
performance penalty, especially if the database is on a different
machine and you have network speed to factor in.
The like operator will automatically try and use the available index.
select name
from employee
where name like 'A%'
will use the index on 'name', but
select name
from employee
where name like '%a'
can not use the index, and so doesn't.
Hope that helps
Adam.
query component is processed by the application. That means that the
database will have to return all the records to the application, and
the component can then do a search for it. Even if the component does
use some form of binary search on the dataset, you have already paid a
performance penalty, especially if the database is on a different
machine and you have network speed to factor in.
The like operator will automatically try and use the available index.
select name
from employee
where name like 'A%'
will use the index on 'name', but
select name
from employee
where name like '%a'
can not use the index, and so doesn't.
Hope that helps
Adam.