0

i need to see the performance of the queries in a Java app which use JPA/Hibernate/postgres, took me a while to find the postgres log file

/var/lib/pgsql/9.2/data/pg_log/postgresql-*.log

however i only found the queries from other application on other database,

i tried to modify the postgresql.conf to add

log_statement = 'all'

how can i make postgres to log my queries too? and how i can do it in my code? Thanks

1 Answer 1

1

the postgresql.conf setting will log all queries on all databases. You must restart (or at least reload) PostgreSQL after editing that setting (out of habit I always do a restart).

Other options are available though which are not such of a broad stroke (and these override that setting so may be also causing your issue:

ALTER USER foo SET log_statements = 'all';

This will log all statements by database user foo.

ALTER DATABASE foo SET log_statements = 'all';

This will log all statements in the foo database. Iirc the order of precidence is user, database, postgresql.conf value.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.