Giter Club home page Giter Club logo

pg_check_indexes's Introduction

pg_check_indexes

Test your PostgreSQL btree indexes for logical corruption

How to

To use this program you should have:

  • Ruby 2.4.0
  • Gem pg
  • Gem optiparse

To use it, navigate to the directory you've downloaded and issue: ruby pg_check_indexes.rb

It will test all the indexes in the database that you connect by default as if you're using psql (usually the same as your username in a local socket connection to PostgreSQL).

You have some more advanced options for other databases or servers:

    -d, --database DBNAME            The database name to connect to
    -u, --user DBUSER                PostgreSQL user name
    -h, --hostname DBHOSTNAME        PostgreSQL hostname
    -p, --port DBPORT                PostgreSQL listen port
    -t, --table TABLENAME            Check only a selected table, use schema qualified names.
    -T, --threshold MAX_TABLE_SIZE   in bytes, 0 for unlimited
    -s, --stop-on-failure            If "y", execution will stop when corruption found

It's recommended that you set a threshold of some megabytes for a first run, specially if you're testing large tables and indexes, the program will skip tables larger then the specified value.

The password should be entered manually if required by your pg_hba.conf settings, or you can use .pgpass Since the Gem pg uses libpq, this program behaves as if you're using standard PostgreSQL tools.

The flag --stop-on-failure may be useful in case you want to stop testing when a first corruption is found.

The program will exit with 0 if no corruption is found otherwise it will exit with 1, so it's easily integrated with deployment automation or continuous integration tools like Jenkins.

Credits and License

This program was developed by Doctolib.

It's licensed under the standard MIT license.

pg_check_indexes's People

Contributors

flaviogurgel avatar matheusoliveira avatar

Watchers

James Cloos avatar  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.