Re: SUM() Taking Too Long
From: Huiyong Lau (huiyong_lau_at_hotmail.com)
Date: 11/30/04
- Next message: james: "cannot copy image column from table to table"
- Previous message: Patrick: "Re: Restore with different database and filegroup name"
- In reply to: Ian Smith: "SUM() Taking Too Long"
- Next in thread: Bernie Yaeger: "Re: SUM() Taking Too Long"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 30 Nov 2004 13:00:08 +1100
Most likely the queries were using a different execution plans. Can you
post those execution plans?
Regards,
Huiyong
"Ian Smith" <Ian Smith@discussions.microsoft.com> wrote in message
news:273A0688-70AA-4C91-96CA-28A7567573E3@microsoft.com...
> I've got a UDF that executes the following query:
>
> SELECT SUM(dbo.AdjustedOrderTotal(tblOrders.ID))
> FROM tblOrders INNER JOIN tblPeople ON tblOrders.SoldToContactID =
> tblPeople.ID
> WHERE tblPeople.CompanyID = 1
>
> The problem is this query takes about 12 seconds to execute. When I remove
> the SUM() from the query (as in "SELECT
dbo.AdjustedOrderTotal(tblOrders.ID)
> FROM..."), the query executes almost instantly and returns two values. It
> shouldn't take 12 seconds to sum up two values.
>
> Does anybody have any idea why aggregating these results would cause such
a
> huge delay?
- Next message: james: "cannot copy image column from table to table"
- Previous message: Patrick: "Re: Restore with different database and filegroup name"
- In reply to: Ian Smith: "SUM() Taking Too Long"
- Next in thread: Bernie Yaeger: "Re: SUM() Taking Too Long"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|