logging statements in PostgreSQL
Hi all,
I am planning to use pgbadger for analyzing queries. Documentation for
pgbadger says "Do not enable log_statement as their log format will not be
parsed by pgBadger. "
I have
log_min_duration_statement = 0
I do see quite a few SELECTs, INSERTS etc in the log files, function calls
too, for example.
select sp_pg_refresh_alert_data(current_date);
But the SELECT and INSERT in the function are not getting logged. Is that
how PostgreSQL logging works, or I have missed something?
Regards,
Jayadevan
On Wed, Sep 25, 2013 at 12:18 PM, Jayadevan M
<maymala.jayadevan@gmail.com> wrote:
Hi all,
I am planning to use pgbadger for analyzing queries. Documentation for
pgbadger says "Do not enable log_statement as their log format will not be
parsed by pgBadger. "
I have
log_min_duration_statement = 0
I do see quite a few SELECTs, INSERTS etc in the log files, function calls
too, for example.
select sp_pg_refresh_alert_data(current_date);
But the SELECT and INSERT in the function are not getting logged. Is that
how PostgreSQL logging works, or I have missed something?
Have a look at auto_explain module which has configuration parameter:
"auto_explain.log_nested_statements (boolean)"
auto_explain.log_nested_statements causes nested statements
(statements executed inside a function) to be considered for logging.
When it is off, only top-level query plans are logged.
http://www.postgresql.org/docs/devel/static/auto-explain.html
--
Amit Langote
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
Thanks for the pointer. I do not really want to log the plans of queries,
just the queries, execution time and a couple of other details
(database,user). If I use the auto-explain module, it will end up printing
the plan for all query execution in the log files?
On Wed, Sep 25, 2013 at 1:43 PM, Amit Langote <amitlangote09@gmail.com>wrote:
Show quoted text
On Wed, Sep 25, 2013 at 12:18 PM, Jayadevan M
<maymala.jayadevan@gmail.com> wrote:Hi all,
I am planning to use pgbadger for analyzing queries. Documentation for
pgbadger says "Do not enable log_statement as their log format will notbe
parsed by pgBadger. "
I have
log_min_duration_statement = 0
I do see quite a few SELECTs, INSERTS etc in the log files, functioncalls
too, for example.
select sp_pg_refresh_alert_data(current_date);
But the SELECT and INSERT in the function are not getting logged. Isthat
how PostgreSQL logging works, or I have missed something?
Have a look at auto_explain module which has configuration parameter:
"auto_explain.log_nested_statements (boolean)"
auto_explain.log_nested_statements causes nested statements
(statements executed inside a function) to be considered for logging.
When it is off, only top-level query plans are logged.http://www.postgresql.org/docs/devel/static/auto-explain.html
--
Amit Langote
Jayadevan M wrote:
Thanks for the pointer. I do not really want to log the plans of queries, just the queries, execution
time and a couple of other details (database,user). If I use the auto-explain module, it will end up
printing the plan for all query execution in the log files?
You can configure it so that only statements exceeding a certain
duration will be logged.
Yours,
Laurenz Albe
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
Hi,
I was looking for options to make sure SQLs executed as part of functions
also get logged. Since this is a production system, I wanted to do it
without the EXPLAIN also written to the logs. May be that is not possible?
Regards,
Jayadevan
On Mon, Sep 30, 2013 at 5:08 PM, Albe Laurenz <laurenz.albe@wien.gv.at>wrote:
Show quoted text
Jayadevan M wrote:
Thanks for the pointer. I do not really want to log the plans of
queries, just the queries, execution
time and a couple of other details (database,user). If I use the
auto-explain module, it will end up
printing the plan for all query execution in the log files?
You can configure it so that only statements exceeding a certain
duration will be logged.Yours,
Laurenz Albe