G
Glint
Hi All,
I have a query like this:
SELECT vCashTransactions0.Zone, vCashTransactions0.TDate,
vCashTransactions0.ACCode, vCashTransactions0.Amount,
vCashTransactions0.ItemAmount, Accounts.AccountID,
DSum("[Amount]","vCashTransactions0","[ACCode]=" & [AccountID]) AS TAmount1
FROM Accounts INNER JOIN vCashTransactions0 ON Accounts.AccountID =
vCashTransactions0.ACCode;
There are only 1356 records in the vCashTransactions0 recordset, which has
TDate as a date field, Amount and TAmount fields as currency, others as long
integer. When I run this query, it is executed in 2 seconds or less, judging
by the time it takes to display "Record: 1 of 1356" in the Navigation button.
When I replace the domain aggregate with a select statement,
TAmount: (SELECT Sum(Amount) FROM vCashTransactions0 WHERE ACCode=AccountID)
This time it takes at least 15 seconds for the Navigation button to finish
displaying.
I had the impression that a SELECT statement was always preferable to a
domain aggregate function, but how do I explain the time difference in
execution this occasion? Can you guess what I am doing wrong? Execution time
is of importance because the table will grow to hundreds of thousand records.
I have a query like this:
SELECT vCashTransactions0.Zone, vCashTransactions0.TDate,
vCashTransactions0.ACCode, vCashTransactions0.Amount,
vCashTransactions0.ItemAmount, Accounts.AccountID,
DSum("[Amount]","vCashTransactions0","[ACCode]=" & [AccountID]) AS TAmount1
FROM Accounts INNER JOIN vCashTransactions0 ON Accounts.AccountID =
vCashTransactions0.ACCode;
There are only 1356 records in the vCashTransactions0 recordset, which has
TDate as a date field, Amount and TAmount fields as currency, others as long
integer. When I run this query, it is executed in 2 seconds or less, judging
by the time it takes to display "Record: 1 of 1356" in the Navigation button.
When I replace the domain aggregate with a select statement,
TAmount: (SELECT Sum(Amount) FROM vCashTransactions0 WHERE ACCode=AccountID)
This time it takes at least 15 seconds for the Navigation button to finish
displaying.
I had the impression that a SELECT statement was always preferable to a
domain aggregate function, but how do I explain the time difference in
execution this occasion? Can you guess what I am doing wrong? Execution time
is of importance because the table will grow to hundreds of thousand records.