Giter Club home page Giter Club logo

pgbouncer_wrapper's Introduction

pgbouncer_wrapper

This project was originally inspired by Peter Eisentraut's excellent post

If you've ever wanted to run SQL queries against pgbouncer's SHOW output, this is a handy way to do just that.

To build it, just do this:

make
make install

Be sure that you have pg_config installed and in your path. If you used a package management system such as RPM to install PostgreSQL, be sure that the -devel package is also installed. If necessary tell the build process where to find it:

env PG_CONFIG=/path/to/pg_config make && make install

Once pgbouncer_wrapper is installed, you can add it to a database like this:

CREATE EXTENSION pgbouncer_wrapper;

You can find how many clients are coming from each address like this:

SELECT
    addr, count(*)
FROM
    clients
GROUP BY addr
ORDER BY count(*) DESC;

You can change pgbouncer settings like this:

SELECT set('default_pool_size', '300');

To see whether the current configuration is out of step with pgbouncer.ini, you can do:

SELECT
    count(*) > 0 AS "out of step"
FROM
    regexp_split_to_table(
        pg_read_file('/etc/pgbouncer/pgbouncer.ini'),
        E'\n'
    ) WITH ORDINALITY AS t(l, o)
JOIN
    config c
    ON (
        c.key =
        (string_to_array(t.l, ' = '))[1]
    )
WHERE
    format('%s = %s', key, value) <> l;

Dependencies

pgbouncer_wrapper depends on dblink.

Copyright and License

Copyright (c) 2015-2023 David Fetter [email protected].

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.