Index bloat? Try pgindexrebuild, a production friendly index debloater

From: Rory McCann <rory(at)technomancy(dot)org>
To: pgsql-admin(at)postgresql(dot)org
Subject: Index bloat? Try pgindexrebuild, a production friendly index debloater
Date: 2016-09-06 07:16:09
Message-ID: nqlqfn$f78$1@blaine.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-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.

--

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Poul Kristensen 2016-09-06 08:41:39 Re: recovery.conf
Previous Message Albe Laurenz 2016-09-05 12:24:25 Re: recovery.conf