If there are really many rows in table , select count(1) would be a little bit slow,It's slow due to several things happening all at once. There are a lot of inserts and updates happening. There is periodically a bulk insert of 500k - 1 mill rows happening. I'm doing a vacuum anaylyze every hour due to the amount of transactions happening, and a vacuum full every night. All this has caused selects to be very slow. At times, a "select count(1)" from a table will take several mins. I don't think selects would have to wait on locks by inserts/updates would it?
I would just like to do anything possible to help speed this up.
for postgresql use sequential scan to count the rows. If the query is other kind,
then may be check if there are index on search condition or use EXPLAIN command
to see the query plan would be greatly help.
By the way, what's the version of your postgresql? older version (<7.4?) still suffer from index
space bloating.
regards
Laser
---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings