Re: script to drop and create all indexes in a database with parameter concurrently

From: "Doom(dot)zhou" <zzepaigh(at)gmail(dot)com>
To: "Campbell, Lance" <lance(at)illinois(dot)edu>
Cc: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: script to drop and create all indexes in a database with parameter concurrently
Date: 2013-12-18 06:19:04
Message-ID: CAK=muZv5yG3t=Gr1sBNiXvXNyoboVvUW_n1b9Xfg4axniobS2g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Wed, Dec 18, 2013 at 4:24 AM, Campbell, Lance <lance(at)illinois(dot)edu> wrote:

> Below is a Linux script I wrote that will drop and create all of the
> indexes for your database with the “concurrently” parameter.
>
>
>
> #!/bin/sh
>
>
>
> dbhost=localhost
>
> database=somedatabasename
>
> dbschema=/tempfile/dbschema.txt
>
> filtered=/tempfile/dbschema_filtered.txt
>
> sql=/tempfile/rebuild_indexes.sql
>
>
>
> rm "$dbschema"
>
> rm "$filtered"
>
> rm "$sql"
>
>
>
> pg_dump -s -h "$dbhost" "$database" > "$dbschema"
>
>
>
Great script !
i think you can add parallel perform each couple (drop & create index). ^^

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Doom.zhou 2013-12-18 07:43:01 Re: script to drop and create all indexes in a database with parameter concurrently
Previous Message Bruce Momjian 2013-12-18 02:58:42 Re: Notice about psql !