Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 282
  • Last Modified:

Where to find sql server query cost

Hi Expert,

I run the query from exam 433 book, it said this query cost is 151, where I can find this number? Thanks in advance.


USE AdventureWorks;

SELECT
    soh.SalesOrderID
    ,soh.OrderDate
    ,(
        SELECT TOP(1)
            sod1.UnitPrice
        FROM Sales.SalesOrderDetail AS sod1
        WHERE sod1.SalesOrderID = soh.SalesOrderID
        ORDER BY sod1.OrderQty DESC
    ) AS UnitPrice
    ,(
        SELECT TOP(1)
            sod2.OrderQty
        FROM Sales.SalesOrderDetail AS sod2
        WHERE sod2.SalesOrderID = soh.SalesOrderID
        ORDER BY sod2.OrderQty DESC
    ) AS OrderQty
FROM Sales.SalesOrderHeader AS soh
WHERE soh.TerritoryID = 4;
0
dshi15
Asked:
dshi15
  • 2
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
please see this page to learn about how to start debugging queries in terms of performance:
http://msdn.microsoft.com/en-us/library/ff650689.aspx
0
 
dshi15Author Commented:
the page you sent is outdated, could you just point out where to click to check cost number?
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
sorry, although the sql 2000 basics are still transposable into sql 2005/2008

ok, let's see, here a more update article about using explain plans, which include the cost:
http://msdn.microsoft.com/en-us/library/ms178071.aspx

this said, not sure what the book actually means about this "cost being 151 ...

0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now