When "FetchAll=False" query.close took so long!
Posted: Wed 08 Dec 2010 10:05
If Fetchall is False, the query.close method took some time to complete the job.
If you are connecing to a local database, you may not notice this extra waiting. But if you are connecting to a remote database and if you have a few joins in yor SQL then it becomes a problem.
We tried this with a simple empty application:
placed a TMSConnection, a TMSQuery, a TMSDataSource and a DBGrid
we set the connection to a remote database. the sql is selecting 15 columns from orders,orderlines and customers tables. There are 1500 records in the resultset, but since the fetchall=False only first 50 is loaded at opening.
The query.open method takes nearly 1 second (very normal).
But the query.close method takes nearly 5 seconds.
We tried it with 25.000 records and opening is again 1 second, but closing this time took 17 seconds !
We also tried it with a simple "select * from table" with 300.000 records again with a remote connection. But everything is normal in this case.
Please note that, we do not move inside the grid, we do not call any Locate or Last method. Just open and then close.
Any help is greatly appreciated, thanks.
If you are connecing to a local database, you may not notice this extra waiting. But if you are connecting to a remote database and if you have a few joins in yor SQL then it becomes a problem.
We tried this with a simple empty application:
placed a TMSConnection, a TMSQuery, a TMSDataSource and a DBGrid
we set the connection to a remote database. the sql is selecting 15 columns from orders,orderlines and customers tables. There are 1500 records in the resultset, but since the fetchall=False only first 50 is loaded at opening.
The query.open method takes nearly 1 second (very normal).
But the query.close method takes nearly 5 seconds.
We tried it with 25.000 records and opening is again 1 second, but closing this time took 17 seconds !
We also tried it with a simple "select * from table" with 300.000 records again with a remote connection. But everything is normal in this case.
Please note that, we do not move inside the grid, we do not call any Locate or Last method. Just open and then close.
Any help is greatly appreciated, thanks.