From: | Andrew Sullivan <andrew(at)libertyrms(dot)info> |
---|---|
To: | PostgreSQL general list <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: [HACKERS] []performance issues |
Date: | 2002-08-06 21:45:00 |
Message-ID: | 20020806174500.C29630@mail.libertyrms.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
On Fri, Aug 02, 2002 at 02:08:02PM -0400, Rod Taylor wrote:
>
> Of course, as suggested this is easily overcome by keeping your own c
> counter.
>
> begin;
> insert into bigtable values ();
> update into counttable set count=count+1;
> commit;
>
> Now you get all the fun concurrency issues -- but fetching the
> information will be quick. What happens more, the counts, or the
> inserts :)
You could get around this with a trigger that just inserts 1 into one
table (call it counter_unposted), and then using an external process
to take those units, add them to the value in counter_posted, and
delete them from counter_unposted. You'd always be a few minutes
behind, but you'd get a counter that's pretty close without too much
overhead. Of course, this raises the obvious question: why use
count() at all?
A
--
----
Andrew Sullivan 87 Mowat Avenue
Liberty RMS Toronto, Ontario Canada
<andrew(at)libertyrms(dot)info> M6K 3E3
+1 416 646 3304 x110
From | Date | Subject | |
---|---|---|---|
Next Message | scott.marlowe | 2002-08-06 22:00:22 | Re: URGENT: Database keeps crashing - suspect damaged |
Previous Message | scott.marlowe | 2002-08-06 20:59:11 | Re: URGENT: Database keeps crashing - suspect damaged |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2002-08-07 01:09:14 | Re: Open 7.3 items |
Previous Message | qdeng | 2002-08-06 21:35:41 | How the |