Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Show queries running on PostgreSQL backends

NotificationsYou must be signed in to change notification settings

adjust/pg_querylog

Repository files navigation

Build Status

pg_querylog

Show queries running on PostgreSQL backends.

Installation

make && make installecho "shared_preload_libraries='pg_querylog'" >> postgresql.confpsql postgres -c "create schema querylog; create extension pg_querylog schema querylog;"

Also you can usesession_preload_libraries, but thenenabled option should be alwayson since each startingbackend will rewrite the value.

echo "session_preload_libraries='pg_querylog'" >> postgresql.conf

Using

Make sure it's loaded:

show session_preload_libraries

and enabled (by default it is disabled):

show pg_querylog.enabled

Get all saved queries usingget_queries function:

select * from querylog.get_queries()

Result columns:

  • pid - backend process ID
  • query - running (or runned) query
  • params - query parameters in case of parametrized query
  • start_time - query start time
  • end_time - query end time (ifrunning == false)
  • running - running status
  • overflow - shows thatbuffer_size is enough for this item

Parameters:

  • pg_querylog.buffer_size - buffer size for each saved query, calculated as sum of lenghts of query and its params.
  • pg_querylog.enabled - controls saving queries.

For only running queriesrunning_queries use this view:

select * from querylog.running_queries;

About

Show queries running on PostgreSQL backends

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp