pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rory McCann <rory@technomancy.org>
To: pgsql-admin@postgresql.org
Subject: Index bloat? Try pgindexrebuild, a production friendly index debloater
Date: Tue, 6 Sep 2016 09:16:09 +0200
Message-ID: <nqlqfn$f78$1@blaine.gmane.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-admin>

Hello all,

If you use/update a PostgreSQL server for a long time,
one problem you may come across is index bloat. Your database will grow
in size on your disk, your indexes getting larger on disk. It's no fun
when your database fills up the disk and won't start anymore. I've had
this problem when using Nominatim, an open source address geocoder for
OpenStreetMap/

There are several solutions to this, but I wanted a way to fix index
bloat while still being able to use the database as a production
database, so I wrote pgindexrebuild:

    https://github.com/rory/pgindexrebuild

It uses CREATE INDEX CONCURRENTLY to create a new index and
replace the old bloated one afterwards. The CONCURRENTLY ensure that you
can still read and write from the table while it is creating a new
index. It has some nice things like lock files, bloat thresholds, and
logging, to allow you to put it in cron and forget about it. "Set up and
forget" is a design goal.

Although I'm using this often, I'm always open to suggestions about
braindead things I might be doing. ☺ Suggestions welcome!

This is inspired by [pgtoolkit](https://github.com/grayhemp/pgtoolkit)
which does the same thing for table bloat.

-- 

Attachments:

  signature.asc (application/pgp-signature, 489B) download

view thread (2+ messages)  latest in thread

Message-ID: <nqlqfn$f78$1@blaine.gmane.org>
Permalink:  ../nqlqfn$f78$1@blaine.gmane.org/
Also on:    postgresql.org/message-id/nqlqfn$f78$1@blaine.gmane.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: rory@technomancy.org
  Subject: Re: Index bloat? Try pgindexrebuild, a production friendly index debloater
  In-Reply-To: <nqlqfn$f78$1@blaine.gmane.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox