Re: pg_stat_statements with fetch

From: Rick Otten <rottenwindfish(at)gmail(dot)com>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: pg_stat_statements with fetch
Date: 2017-05-21 13:53:23
Message-ID: CAMAYy4L8tccSwfy8eCBcRMQH16VCd_k8EtAMPbxT03jar3WEqw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Would turning on logging of temp files help? That often reports the query
that is using the temp files:
log_temp_files = 0

It probably wouldn't help if the cursor query never pulls from a temp file,
but if it does ...

On Fri, May 19, 2017 at 7:04 PM, Jeff Janes <jeff(dot)janes(at)gmail(dot)com> wrote:

> I'm spoiled by using pg_stat_statements to find the hotspot queries which
> could use some attention.
>
> But with some recent work, all of the hotspots are of the form "FETCH 1000
> FROM c3". The vast majority of the queries return less than 1000 rows, so
> only one fetch is issued per execution.
>
> Is there an automated way to trace these back to the parent query, without
> having to strong-arm the driving application into changing its cursor-using
> ways?
>
> pg_stat_statements v1.4 and postgresql v9.6 (or 10beta1, if it makes a
> difference)
>
> Sometimes you can catch the DECLARE also being in pg_stat_statements, but
> it is not a sure thing and there is some risk the name got freed and reused.
>
> log_min_duration_statement has the same issue.
>
> Cheers,
>
> Jeff
>

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2017-05-21 14:33:06 Re: Bulk persistence strategy
Previous Message Riaan Stander 2017-05-21 06:25:49 Bulk persistence strategy