pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedDrop All Index
5+ messages / 3 participants
[nested] [flat]
* Drop All Index
@ 2006-11-26 15:52 Marcelo Costa <marcelojscosta@gmail.com>
0 siblings, 1 reply; 5+ messages in thread
From: Marcelo Costa @ 2006-11-26 15:52 UTC (permalink / raw)
To: pgsql-admin
Hi to all,
Anybody can help me how to proced to delete all index from my database,
exists any command to this ?
Thanks,
--
Marcelo Costa
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Drop All Index
@ 2006-11-27 14:27 Alvaro Herrera <alvherre@commandprompt.com>
parent: Marcelo Costa <marcelojscosta@gmail.com>
0 siblings, 2 replies; 5+ messages in thread
From: Alvaro Herrera @ 2006-11-27 14:27 UTC (permalink / raw)
To: Marcelo Costa <marcelojscosta@gmail.com>; +Cc: pgsql-admin
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!
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Drop All Index
@ 2006-11-27 14:47 Peter Childs <peterachilds@gmail.com>
parent: Alvaro Herrera <alvherre@commandprompt.com>
1 sibling, 1 reply; 5+ messages in thread
From: Peter Childs @ 2006-11-27 14:47 UTC (permalink / raw)
To: pgsql-admin
On 27/11/06, Alvaro Herrera <alvherre@commandprompt.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.
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Drop All Index
@ 2006-11-27 14:59 Alvaro Herrera <alvherre@commandprompt.com>
parent: Peter Childs <peterachilds@gmail.com>
0 siblings, 0 replies; 5+ messages in thread
From: Alvaro Herrera @ 2006-11-27 14:59 UTC (permalink / raw)
To: Peter Childs <peterachilds@gmail.com>; +Cc: pgsql-admin
> >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 ?
BTW if you speak spanish you may find yourself more comfortable on the
pgsql-es-ayuda list.
(This is addressed to Marcelo, somewhere the "From/Cc" list was trimmed
so I don't have his address here. Please don't do that.)
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Drop All Index
@ 2006-11-27 16:36 Marcelo Costa <marcelojscosta@gmail.com>
parent: Alvaro Herrera <alvherre@commandprompt.com>
1 sibling, 0 replies; 5+ messages in thread
From: Marcelo Costa @ 2006-11-27 16:36 UTC (permalink / raw)
To: Marcelo Costa <marcelojscosta@gmail.com>; pgsql-admin
Hi, Alvaro, thanks, I make a function to do this.
[],s
Marcelo.
2006/11/27, Alvaro Herrera <alvherre@commandprompt.com>:
>
> 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!
>
> --
> Alvaro Herrera
> http://www.CommandPrompt.com/
> PostgreSQL Replication, Consulting, Custom Development, 24x7 support
>
--
Marcelo Costa
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2006-11-27 16:36 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-11-26 15:52 Drop All Index Marcelo Costa <marcelojscosta@gmail.com>
2006-11-27 14:27 ` Alvaro Herrera <alvherre@commandprompt.com>
2006-11-27 14:47 ` Peter Childs <peterachilds@gmail.com>
2006-11-27 14:59 ` Alvaro Herrera <alvherre@commandprompt.com>
2006-11-27 16:36 ` Marcelo Costa <marcelojscosta@gmail.com>
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