Re: Queries Per Second (QPS)

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
Cc: Adam Scott <adam(dot)c(dot)scott(at)gmail(dot)com>, postgres performance list <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Queries Per Second (QPS)
Date: 2015-09-27 17:34:19
Message-ID: CAMkU=1wpZf-Bd6dS8Cf-FMAc9YRtibJdg-TeQJC4fKUSa_DyBQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Sat, Sep 26, 2015 at 11:06 PM, Guillaume Lelarge <guillaume(at)lelarge(dot)info>
wrote:

> Le 27 sept. 2015 8:02 AM, "Guillaume Lelarge" <guillaume(at)lelarge(dot)info> a
> écrit :
> >
> > Le 26 sept. 2015 6:26 PM, "Adam Scott" <adam(dot)c(dot)scott(at)gmail(dot)com> a
> écrit :
> > >
> > > How do we measure queries per second (QPS), not transactions per
> second, in PostgreSQL without turning on full logging which has a
> performance penalty and can soak up lots of disk space?
> > >
> >
> > The only way I can think of is to write an extension that will execute
> some code at the end of the execution of a query.
> >
> > Note that this might get tricky. Do you want to count any query? Such as
> those in explicit transactions and those in plpgsql functions? People might
> not see this your way, which may explain why I don't know of any such
> extension.
> >
>
> Thinking about this, such an extension already exists. It's
> pg_stat_statements. You need to sum the count column of the
> pg_stat_statements from time to time. The difference between two sums will
> be your number of queries.
>

That is what I was thinking, but the pg_stat_statement does discard
statements sometimes, discarding the counts with them. You would have set
pg_stat_statements.max to a higher value than you ever expect to get
reached.

Cheers,

Jeff

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Graeme B. Bell 2015-09-29 08:41:01 Another parallel postgres project...
Previous Message Guillaume Lelarge 2015-09-27 06:06:24 Re: Queries Per Second (QPS)