From: Tom Lane <tgl@sss.pgh.pa.us>
To: Chris Rimmer <chrisr@we7.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Select from sequence in slow query log
Date: Fri, 01 Jun 2012 09:47:53 -0400
Message-ID: <23954.1338558473@sss.pgh.pa.us> (raw)
In-Reply-To: <CAE9MXz-H_KUPrkvgX1iKbZoEo_dOg9-yPZw1CcO5UBjRbWK_DQ@mail.gmail.com>
References: <CAE9MXz-H_KUPrkvgX1iKbZoEo_dOg9-yPZw1CcO5UBjRbWK_DQ@mail.gmail.com>
Chris Rimmer <chrisr@we7.com> writes:
> While investigating some performance issues I have been looking at slow
> queries logged to the postgresql.log file. A strange thing that I have
> seen is a series of apparently very slow queries that just select from a
> sequence. It is as if access to a sequence is blocked for many sessions and
> then released as I get log entries like this appearing:
> LOG: duration: 23702.553 ms execute <unnamed>: /* dynamic native SQL
> query */ select nextval ('my_sequence') as nextval
> LOG: duration: 23673.068 ms execute <unnamed>: /* dynamic native SQL
> query */ select nextval ('my_sequence') as nextval
> LOG: duration: 23632.729 ms execute <unnamed>: /* dynamic native SQL
> query */ select nextval ('my_sequence') as nextval
> ....(Many similar lines)....
That's pretty weird. What else is being done to that sequence? Is it
only the sequence ops that are slow, or does this happen at times when
everything else is slow too? Can you create a reproducible test case?
regards, tom lane
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 using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, chrisr@we7.com
Subject: Re: Select from sequence in slow query log
In-Reply-To: <23954.1338558473@sss.pgh.pa.us>
* 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