Is there any optimizations I can do with this statement to get the count of used rows?

Posted by RPS on Stack Overflow See other posts from Stack Overflow or by RPS
Published on 2010-06-09T13:22:19Z Indexed on 2010/06/09 14:02 UTC
Read the original article Hit count: 137

Filed under:

Is there any optimizations I can do with this statement to get the count of used rows.

Note: The ProductOrderInfo table has over 40 million rows in it.

SELECT @TotalUsed = COUNT(*) FROM ProductInfo WITH (NOLOCK) WHERE ProductInfoId IN ( SELECT ProductInfoId FROM ProductOrderInfo WITH (NOLOCK) );

© Stack Overflow or respective owner

Related posts about sql