Re: Displaying current query - eliminating - Mailing list pgsql-novice

From Rieback Melanie
Subject Re: Displaying current query - eliminating
Date
Msg-id Pine.GSO.4.56.0510220825210.20875@flits.few.vu.nl
Whole thread Raw
In response to Re: Displaying current query - eliminating  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-novice
Thanks for your response!

> Sorry, there's basically 0 chance of that happening with any
> reliability.  The stats system is designed not to slow down actual
> transactions at all, which is what it would have to do to guarantee
> instantaneous response.
Is there a way that I can manually slow down a query or transaction, to
ensure that I see it when I type 'SELECT current_query FROM
pg_stat_activity;'.  I already tried explicitly ending transactions by
typing:

BEGIN; SELECT current_query FROM pg_stat_activity; COMMIT;

and

BEGIN; COMMIT; SELECT current_query FROM pg_stat_activity;

but that didn't seem to help.  Is there a kindof sleep command that I can
use to turn this particular query into a 'long' query, that will register
instantaneously as the current_query? (This is assuming that the database
is relatively empty, so I can't create a normal query that will take that
long).

> You could improve the reaction time by reducing PGSTAT_STAT_INTERVAL
> in the source code (see backend/postmaster/pgstat.c),
Would this have a different effect than typing:
\set pgstat_stat_interval 0
at the command prompt in the pgSQL client itself?

> but you'll incur corresponding increases in overhead, and you'll never
> get to the point of certain repeatability.
I don't care at all about increases in overhead.  I warned you that my
request is a strange one, but this is more of a puzzle, that happens to
have a real use for me.  It also doesn't have to be 100% repeatable.  50%
or even 25% repeatable would be good enough for me, as long as it works a
significant percentage of the time.

Thanks again!

Melanie


pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: Displaying current query - eliminating
Next
From:
Date:
Subject: Excellent PGSQL Tutorial, WinXP as Service - Configure for Manual Operation