News for hackers. Stuff that matters.
Re:Why Use Postgres by lobster_johnson on Wednesday May 02, 2012 @01:25PM (#3920160)
As others have pointed out, there is no such "fiasco". However, if you want to simply count the entire table and don't care if the number is exact within the current transaction, you can cheat and do:

    select n_live_tup from pg_stat_user_tables
    where relname = 'your_table_name'
This will access the internal statistics about how many tuples are in the table. It ignores the transaction's isolation level since it's a global value, and it may be a few milliseconds out of date, but it's otherwise correct.

There are no comments on this comment yet.