Re: counting rows

From: Tony Rogerson <>
Date: Fri, 31 Mar 2006 08:46:20 +0100
Message-ID: <e0imo5$312$1$>

Number 2 will be best because you are effectively storing the aggregate instead of the server having to count the number of rows in the table which would require IO.


Tony Rogerson
SQL Server MVP - free video tutorials

<> wrote in message

> Consider the tables USERS and PICTURES. When retrieving the number of
> pictures from a user there are two ways:
> 1) I count them from pictures table.
> 2) I pick it directly from a field "numPictures" in table users.
> How are you used to do this? Which is better?
> Thanks
Received on Fri Mar 31 2006 - 09:46:20 CEST

Original text of this message