I smell a religious war in the aii:-).
Can you go several days in a row without doing select count(*) on any
of your tables?
I suspect that this is somewhat a domain specific issue. In some areas
you don't need to know the total number of rows in your tables, in
others you do.
I also suspect that you're right, that end user applications don't use
this information as often as DBAs would. On the other hand, it seems
whenever you want to optimize your app (something relevant to this list),
one of the things you do need to know is the number of rows in your
On Thu, Oct 02, 2003 at 10:08:18PM -0400, Christopher Browne wrote:
> The world rejoiced as dror(at)zapatec(dot)com (Dror Matalon) wrote:
> > I don't have an opinion on how hard it would be to implement the
> > tracking in the indexes, but "select count(*) from some table" is, in my
> > experience, a query that people tend to run quite often.
> > One of the databases that I've used, I believe it was Informix, had that
> > info cached so that it always new how many rows there were in any
> > table. It was quite useful.
> I can't imagine why the raw number of tuples in a relation would be
> expected to necessarily be terribly useful.
> I'm involved with managing Internet domains, and it's only when people
> are being pretty clueless that anyone imagines that "select count(*)
> from domains;" would be of any use to anyone. There are enough "test
> domains" and "inactive domains" and other such things that the raw
> number of "things in the table" aren't really of much use.
> - I _do_ care how many pages a table occupies, to some extent, as that
> determines whether it will fit in my disk space or not, but that's not
> - I might care about auditing the exact numbers of records in order to
> be assured that a data conversion process was done correctly. But in
> that case, I want to do something a whole *lot* more detailed than
> mere COUNT(*).
> I'm playing "devil's advocate" here, to some extent. But
> realistically, there is good reason to be skeptical of the merits of
> using SELECT COUNT(*) FROM TABLE for much of anything.
> Furthermore, the relation that you query mightn't be a physical
> "table." It might be a more virtual VIEW, and if that's the case,
> bets are even MORE off. If you go with the common dictum of "good
> design" that users don't directly access tables, but go through VIEWs,
> users may have no way to get at SELECT COUNT(*) FROM TABLE.
> output = reverse("ac.notelrac.teneerf" "@" "454aa")
> Rules of the Evil Overlord #74. "When I create a multimedia
> presentation of my plan designed so that my five-year-old advisor can
> easily understand the details, I will not label the disk "Project
> Overlord" and leave it lying on top of my desk."
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
Dror Matalon, President
1700 MLK Way
Berkeley, CA 94709
In response to
pgsql-performance by date
|Next:||From: Greg Stark||Date: 2003-10-03 05:13:08|
|Subject: Re: count(*) slow on large tables|
|Previous:||From: CN||Date: 2003-10-03 02:14:07|
|Subject: Is This My Speed Limit?|
pgsql-hackers by date
|Next:||From: Greg Stark||Date: 2003-10-03 04:50:12|
|Subject: Re: minor view creation weirdness|
|Previous:||From: Marc G. Fournier||Date: 2003-10-03 03:39:15|
|Subject: Beta4 Tag'd and Bundled ...|