From: David F. Skoll <dfs@roaringpenguin.com>
To: pgsql-admin@postgresql.org
Subject: Strange performance hit upgrading from 8.0.9 to 8.2.1
Date: Thu, 18 Jan 2007 20:37:33 -0500
Message-ID: <45B020DD.2030603@roaringpenguin.com> (raw)
Hello,
We have a customer running a rather large installation. There are
about 15 machines talking to a PostgreSQL database server. At any
given time, each machine has between around 20 to 120 connections to
the PG server, and the aggregate query rate probably hovers at over
1000 per second.
Our database has a table that looks like this:
database=> \d low_contention_stats
Table "public.low_contention_stats"
Column | Type | Modifiers
-----------+---------+-----------------------------
date | date | default ('now'::text)::date
key | text |
increment | integer | default 1
There are no indexes on that table. Anywhere from 40 to 100
times per second, we insert something like this into the table:
INSERT INTO low_contention_stats(key, increment) VALUES('ACCEPTED', 1);
The INSERTs run outside of any transaction (ie, in their own self-contained
transaction.) The "key" data being inserted is short -- under 25 characters.
We periodically do something like this:
BEGIN;
-- Aggregate the low_contention data into another table
-- and then...
DELETE FROM low_contention_stats;
COMMIT;
and it used to work fine. However, on the upgrade from 8.0.9 to
8.2.1, we suddenly started seeing terrible performance on the INSERTs.
(The aggregation process was disabled -- we were only doing the
INSERTs at the time.) What would happen is that hundreds of back-ends
would acquire locks on the table and it would take many seconds for
all the INSERTs to finish. Things would settle down for a few seconds
to a couple of minutes, and then again - WHAM! Huge contention.
Disabling the INSERTs completely made everything happy, even though
they formed only a small portion of the overall queries. While this
is OK as a stopgap, it's not really a long-term solution because it
disables a fairly useful feature of our software.
Unfortunately, I have no idea how to duplicate the problem in our
lab with the hardware we have access to. :-( Any PostgreSQL gurus
have any insights?
Regards,
David.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: dfs@roaringpenguin.com
Subject: Re: Strange performance hit upgrading from 8.0.9 to 8.2.1
In-Reply-To: <45B020DD.2030603@roaringpenguin.com>
References: <45B020DD.2030603@roaringpenguin.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox