Re: Much Ado About COUNT(*) - Mailing list pgsql-hackers

From Manfred Koizar
Subject Re: Much Ado About COUNT(*)
Date
Msg-id 42tbv0t8sp8af4vgh8arudal6fnhfpii83@email.aon.at
Whole thread Raw
In response to Re: Much Ado About COUNT(*)  ("Jonah H. Harris" <jharris@tvi.edu>)
List pgsql-hackers
On Mon, 24 Jan 2005 08:28:09 -0700, "Jonah H. Harris" <jharris@tvi.edu>
wrote:
>            UPDATE pg_user_table_counts
>                SET rowcount = rowcount + 1
>                WHERE schemaname = this_schemaname
>                    AND tablename = TG_RELNAME;

This might work for small single user applications.  You'll have to keep
an eye on dead tuples in pg_user_table_counts though.

But as soon as there are several concurrent transactions doing both
INSERTs and DELETEs, your solution will in the best case serialise
access to test_tbl or it will break down because of deadlocks.

ServusManfred


pgsql-hackers by date:

Previous
From: "Jim C. Nasby"
Date:
Subject: Built-in casts for ltree
Next
From: Tom Lane
Date:
Subject: Re: bug w/ cursors and savepoints