Author: Tomas Rutkauskas
How to accelerate database searches
Do you want a simple, one-line method for speeding up your database searches? After
you know what your search target is but before beginning your search, disable the
search table with the DisableControls method. This effectively disconnects the
DataSet from the DataSource component. For example:
1 unit Unit1;
2 3 type4 TForm1 = class(TForm)
5 DataSource1: TDataSource;
6 Table1: TTable;
7 Button1: TButton;
8 9 procedure TForm1.Button1Click(Sender: TObject);
10 var11 SeekValue: string;
12 begin13 Table1.DisableControls;
17 18 end.
As the search advances through an index, using the Next method, data aware components attached to the dataset are updated. The speed increase results from severing the connection, avoiding the component updates and restoring the connection when the search is completed.