Re: Select from sequence in slow query log - Mailing list pgsql-performance

From Chris Rimmer
Subject Re: Select from sequence in slow query log
Date
Msg-id CAE9MXz9FwNtuMP=MV5WWaRXj5fQPirM2m1b5sweTmHxokBZ1kQ@mail.gmail.com
Whole thread Raw
In response to Re: Select from sequence in slow query log  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-performance
It looks like this effect only occurs in the middle of the night when there is some kind of automated dump process going on and the system is under higher than normal load. I haven't managed to reproduce them outside of production, but since these oddities don't seem to show up during normal operations, I'm not worrying too much about them now.

Thanks

Chris

On 1 June 2012 14:47, Tom Lane <tgl@sss.pgh.pa.us> wrote:
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


pgsql-performance by date:

Previous
From: Maciek Sakrejda
Date:
Subject: Re: Trouble with plan statistics for behaviour for query.
Next
From: "Kevin Grittner"
Date:
Subject: Re: High load average in 64-core server , no I/O wait and CPU is idle