Re: Drop All Index

From: "Peter Childs" <peterachilds(at)gmail(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: Drop All Index
Date: 2006-11-27 14:47:59
Message-ID: a2de01dd0611270647j17fb3537ra96a6af8e3caf3b9@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On 27/11/06, Alvaro Herrera <alvherre(at)commandprompt(dot)com> wrote:
> Marcelo Costa wrote:
> > Hi to all,
> >
> > Anybody can help me how to proced to delete all index from my database,
> > exists any command to this ?
>
> Sure, you can create a PL/pgSQL function that loops around a "select
> relname from pg_class where relkind='i' AND ..." and then issues DROP
> INDEX for each (or you can do it in shell). Be careful to include a
> clause to select only indexes that are not in system catalogs!
>
> --

Why do you want to?

If you are going to do that you'll have problems with Primary Keys
because you can't drop primary key indexes with drop index so you'll
get quite a few error messages. If you want to remove them you need
"alter table x drop constraint y;"

Peter.

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Alvaro Herrera 2006-11-27 14:59:42 Re: Drop All Index
Previous Message Alvaro Herrera 2006-11-27 14:27:22 Re: Drop All Index