Re: select count(*) from a large table is very slow - Mailing list pgsql-admin

From Daniel Cristian Cruz
Subject Re: select count(*) from a large table is very slow
Date
Msg-id 48d0cacb0705180658n1ce65297xa9f28d56dd4f8426@mail.gmail.com
Whole thread Raw
In response to Re: select count(*) from a large table is very slow  ("Jonah H. Harris" <jonah.harris@gmail.com>)
Responses Re: select count(*) from a large table is very slow  ("Jonah H. Harris" <jonah.harris@gmail.com>)
List pgsql-admin
2007/5/18, Jonah H. Harris <jonah.harris@gmail.com>:
> Yes, a summary table updated by triggers is the only way to have
> correct numbers... but you also pay the overhead of maintaining those
> numbers on every INSERT/UPDATE statement.  If you just need
> *reasonable* guesstimates, use reltuples in pg_class after an analyze.

Oops... INSERT or DELETE... :)

And remember that if using TRUNCATE, it will not run your trigger and
you will need to reset the counter manually.

Regards...
--
Daniel Cristian Cruz

pgsql-admin by date:

Previous
From: "Jonah H. Harris"
Date:
Subject: Re: select count(*) from a large table is very slow
Next
From: "Jonah H. Harris"
Date:
Subject: Re: select count(*) from a large table is very slow