Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux