Board index » delphi » Select Sum generate multi connections
Leonardo Hees Drummond
![]() Delphi Developer |
Tue, 07 Jun 2005 02:15:50 GMT
Select Sum generate multi connections
We have an ISAPI app accessing a SQL Server Database. The WebModule has one
ADOConnection and all the ADOQueries are connected to the database through the ADOConnection. But when the AdoQuery executes a select like "select Sum(value) as A from mytable where ..." the sql trace shows an prepare on the database with "select * from mytable". Before the prepare the app made a connect and after the prepare, a disconnect. In some actions, the app has to execute this select a lot of times, and, becouse of this, a lot of connections are made with the database, and this increase the time of the app response. Why the adoquery with sum (and count) do this prepare, and have to connect and disconnect ? Why, if I do this select with this sintax: "select (select Sum(value) as A from mytable where ...) as A" this problem do not occur ? |