Re: counting rows

From: Tony Andrews <andrewst_at_onetel.com>
Date: 2 Apr 2006 05:20:08 -0700
Message-ID: <1143980408.455354.242450_at_g10g2000cwb.googlegroups.com>


Tony Rogerson wrote:
> > So I guess what you are saying is: given that there IS a column called
> > numPictures in table Users anyway, it is best to use it. You are not
> > suggesting that such a column should generally be created and
> > maintained, which is what I inferred from your answer?
>
> I'm simply answering the question from an implementation and scalability
> point of view rather than relational theory.
>
> I am saying, if performance and scalability requirements dictate
> (implementation of the logical design) then yes, a number_of_pictures column
> should be created, whether that feeds back into the logical model I'm not
> sure as its an implementation thing, in the say way you can argue surrogate
> keys are an implementation thing and shouldn't be in the logical model.

Nothing in the original question suggested that performance and scalability requirements did so dictate! It just asked which was "better". I am concerned that the OP (who is obviously a database newbie or wouldn't be asking the question) could get the impression from your answer that it is always "best" to create and maintain summary columns for data that you may want to select the count of. I would have expected some sort of "it depends" in your answer, but there was none. Of course I don't say NEVER create and maintain such columns, but I would say that they are the exception rather than the rule. Received on Sun Apr 02 2006 - 14:20:08 CEST

Original text of this message