GithubHelp home page GithubHelp logo

isabella232 / pg_querylog Goto Github PK

View Code? Open in Web Editor NEW

This project forked from adjust/pg_querylog

0.0 0.0 0.0 29 KB

Show queries running on PostgreSQL backends

Makefile 2.60% PLpgSQL 3.35% C 73.35% Shell 6.58% Python 6.64% Dockerfile 7.47%

pg_querylog's Introduction

Build Status

pg_querylog

Show queries running on PostgreSQL backends.

Installation

make && make install
echo "shared_preload_libraries='pg_querylog'" >> postgresql.conf
psql postgres -c "create schema querylog; create extension pg_querylog schema querylog;"

Also you can use session_preload_libraries, but then enabled option should be always on since each starting backend 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 using get_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 (if running == false)
  • running - running status
  • overflow - shows that buffer_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 queries running_queries use this view:

select * from querylog.running_queries;

pg_querylog's People

Contributors

ildus avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.