Subject | Re: [ib-support] Delphi TIBQuery.Locate |
---|---|
Author | Martijn Tonies |
Post date | 2002-08-22T07:17Z |
Hi Julien,
With a flat-file/local file database thingy, the "indices" are kept
in memory. Then, when you use a .Locate method, it scans the
index and pulls the records you want from the file.
With a client/server database, the SERVER uses the indices.
And the client "asks" (queries) for a certain resultset - you never
work with a "table" directly, always with a result to a query...
Now, by using TIBQuery and the .Locate method, the only thing
you're doing is pulling all records across the line that you asked
for - (depending on the .SQL property) - then, in the local buffer
you're doing a .Locate and you're searching for the record...
To work with C/S database engines, keep your resultset as small
as possible - so instead of asking for 3000 records - only ask for
a couple that already match certain criteria - like 'Starts with an A'
Hope this helps,
Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
http://www.interbaseworkbench.com
Upscene Productions
http://www.upscene.com
"This is an object-oriented system.
If we change anything, the users object."
> I've got a table Article and an index on the field CODE_BARRES ofAh great ... and what makes you think the index is used?
> this table
>
> when I do
>
> QArticle.Locate('CODE_BARRES', ECodeBare.Text, []);
With a flat-file/local file database thingy, the "indices" are kept
in memory. Then, when you use a .Locate method, it scans the
index and pulls the records you want from the file.
With a client/server database, the SERVER uses the indices.
And the client "asks" (queries) for a certain resultset - you never
work with a "table" directly, always with a result to a query...
Now, by using TIBQuery and the .Locate method, the only thing
you're doing is pulling all records across the line that you asked
for - (depending on the .SQL property) - then, in the local buffer
you're doing a .Locate and you're searching for the record...
To work with C/S database engines, keep your resultset as small
as possible - so instead of asking for 3000 records - only ask for
a couple that already match certain criteria - like 'Starts with an A'
> the answer is very long (nearly one minute, and there's only 3000Of course it does - because it is a flat file system...
> records in the table);
>
> With an Microsoft Access database everything works fine. And in the
Hope this helps,
Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
http://www.interbaseworkbench.com
Upscene Productions
http://www.upscene.com
"This is an object-oriented system.
If we change anything, the users object."