Re: count(*) and bad design was: Experiences with extensibility

Поиск
Список
Период
Сортировка
От Sim Zacks
Тема Re: count(*) and bad design was: Experiences with extensibility
Дата
Msg-id fm2m51$kt9$1@news.hub.org
обсуждение исходный текст
Ответ на Re: count(*) and bad design was: Experiences with extensibility  (Ivan Sergio Borgonovo <mail@webthatworks.it>)
Ответы Re: count(*) and bad design was: Experiences with extensibility  (Ivan Sergio Borgonovo <mail@webthatworks.it>)
Re: count(*) and bad design was: Experiences with extensibility  ("Scott Marlowe" <scott.marlowe@gmail.com>)
Список 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

В списке pgsql-general по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: quick question abt pg_dump and restore
Следующее
От: "Josh Harrison"
Дата:
Сообщение: Re: quick question abt pg_dump and restore