From: | Sim Zacks <sim(at)compulab(dot)co(dot)il> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: count(*) and bad design was: Experiences with extensibility |
Date: | 2008-01-09 14:33:54 |
Message-ID: | fm2m51$kt9$1@news.hub.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Using count(*) is not bad design, though generally it makes sense to use it with
a where.
Saying using count(*) is bad design means that the only design that you can
visualize is the specific one that you are using.
There are tons of real world examples where you need count. That is why so many
people use it as a benchmark.
Obviously if you have an application where millions of rows are added and
subtracted every minute, then the value of count is kind of vague.
However, if you are querying a data warehouse that gets populated once a month,
then count has a huge value. You could use statistics in that case, but it is
much harder to join against other tables when you are using statistics. It is
also less intuitive then using the SQL standard for finding the number of rows.
Sim
From | Date | Subject | |
---|---|---|---|
Next Message | A. Kretschmer | 2008-01-09 14:35:54 | Re: quick question abt pg_dump and restore |
Previous Message | Ivan Sergio Borgonovo | 2008-01-09 14:28:04 | Re: count(*) and bad design was: Experiences with extensibility |