Page 1 of 1

ODAC - speed

Posted: Wed 19 Mar 2008 13:59
by fire.tiger
Hello,

I'd have one question. I have a table which has ~1 million of records
and I display these records using TOraQuery ( just a simple select statement). How to set up the query to have maximal speed, especially when sorting any column ? Runing the query is very fast, but sorting..it is slow.

Thank you.

Posted: Thu 20 Mar 2008 08:53
by Plash
If you sort data by clicking on a column header in TCRDBGrid component, or set IndexFieldNames property of TOraQuery manually, client side sorting is performed. This requires fetching all records to the client.

To speed up sorting, it should be performed on the server side by using ORDER BY in your SELECT statement. You can use SetOrderBy method of TOraQuery to add ORDER BY clause to your statement. If you are using TCRDBGrid, you should set dgeLocalSorting and dgeLocalFilter to False in OptionsEx property of TCRDBGrid.