Ludo Brands wrote 6 lines
You can use indices and locate with TSQLQuery as follows:
SQLQuery1.AddIndex('idx_no_art','no_art',[]);
SQLQuery1.IndexName:='idx_no_art';
SQLQuery1.Open;
...
SQLQuery1.Locate('no_art','200295',[]);
Thanks, that's really interresting, but it does not seam to be useful in my case. Basically my application is a cgi app which receives a request, does some modifications in the database and then sends back some other data based on the request and on the database and then it just quits.
I get the value of the primary key of the table from the request, so I though that because it is the primary key I would be able to quickly jump to it. But it seams that not? From what I understood the solutions are first going through the entire table and indexing it to make future lookups faster. But this does not seam to use the fact that my field is the primary key.
From my experience doing a loop
while not SQLQuery.EOF do
compare
SQLQuery.Next
is *really* slow.
But I doubt that first indexing the whole table and then looking up the value 1 time will be any faster.
I am thinking of moving to FastCGI, but I'm not sure if then I would be able to index the table and gain speed in future requests. maybe...
Felipe Monteiro de Carvalho