TUniTable.Open or TUniTable.Locate too slow?
Posted: Thu 09 Jul 2009 13:02
Hi all,
I have another problem after migration from BDE to UniDAC. In BDE I can use the following lines without problems:
MyTable.Open;
if MyTable.Locate ('PKID', '12345', []) then ...
The Table is very small (~ 50.000 records) and PKID is the Primary Key. In BDE these two lines take less than 1 second.
When I Changed MyTable from TTable to TUniTable the Locate-Method uses 30 seconds. Then I found in this forum, that it is good to use the IndexFieldNames-Property of TUniTable. So I changed the code:
MyUniTable.IndexFieldNames := 'PKID';
MyUniTable.Open;
if MyUniTable.Locate ('PKID', '12345', []) then ...
Now Locate runs very fast, but MyUniTable.Open takes more than 30 seconds.
Then I deleted IndexFieldNames and I tried a filter:
MyUniTable.Filter := 'PKID=' + '''' + '12345' + '''';
MyUniTable.Filtered := true;
MyUniTable.Open;
if MyUniTable.Locate ('PKID', '12345', []) then ...
It's the same: MyUniTable.Open takes more than 30 seconds. I don't want to use a filter. It was only a test, because in the BDE the Filter is good way to speed up the TTable.Open method. But it has no effect on TUniTable.
I tried this with InterBase and Oracle. InterBase is a little bit faster, but not fast enough.
I checked DBMonitor 2.14, but there is only on line: "select * from MYTABLE" for the Open-Command. The Locate-Command or the Filter is not shown in the DBMonitor. Why not?
My Question is: What can I do to open a TUniTable very fast? And how can I locate one record using the Primary Key of the table?
Update 09.07.2009 17:50. Now I tried this:
MyUniTable.Open;
MyUniTable.FilterSQL := 'PKID=' + '''' + '12345' + '''';
if MyUniTable.Locate ('PKID', '12345', []) then ...
That is with InterBase very fast. But this can't be the solution. I cannot write for every line with "Locate" a line with "FilterSQL".
What can I do?
Thanks in Advance for any help.
Kind regards,
Gerd Brinkmann
invent GmbH
I have another problem after migration from BDE to UniDAC. In BDE I can use the following lines without problems:
MyTable.Open;
if MyTable.Locate ('PKID', '12345', []) then ...
The Table is very small (~ 50.000 records) and PKID is the Primary Key. In BDE these two lines take less than 1 second.
When I Changed MyTable from TTable to TUniTable the Locate-Method uses 30 seconds. Then I found in this forum, that it is good to use the IndexFieldNames-Property of TUniTable. So I changed the code:
MyUniTable.IndexFieldNames := 'PKID';
MyUniTable.Open;
if MyUniTable.Locate ('PKID', '12345', []) then ...
Now Locate runs very fast, but MyUniTable.Open takes more than 30 seconds.
Then I deleted IndexFieldNames and I tried a filter:
MyUniTable.Filter := 'PKID=' + '''' + '12345' + '''';
MyUniTable.Filtered := true;
MyUniTable.Open;
if MyUniTable.Locate ('PKID', '12345', []) then ...
It's the same: MyUniTable.Open takes more than 30 seconds. I don't want to use a filter. It was only a test, because in the BDE the Filter is good way to speed up the TTable.Open method. But it has no effect on TUniTable.
I tried this with InterBase and Oracle. InterBase is a little bit faster, but not fast enough.
I checked DBMonitor 2.14, but there is only on line: "select * from MYTABLE" for the Open-Command. The Locate-Command or the Filter is not shown in the DBMonitor. Why not?
My Question is: What can I do to open a TUniTable very fast? And how can I locate one record using the Primary Key of the table?
Update 09.07.2009 17:50. Now I tried this:
MyUniTable.Open;
MyUniTable.FilterSQL := 'PKID=' + '''' + '12345' + '''';
if MyUniTable.Locate ('PKID', '12345', []) then ...
That is with InterBase very fast. But this can't be the solution. I cannot write for every line with "Locate" a line with "FilterSQL".
What can I do?
Thanks in Advance for any help.
Kind regards,
Gerd Brinkmann
invent GmbH