Skip site navigation (1) Skip section navigation (2)

Re: Which indexes to drop

From: Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net>
To: PgSQL Novice ML <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Which indexes to drop
Date: 2002-06-19 10:35:38
Message-ID: 1024482938.13457.16.camel@rebel (view raw or flat)
Thread:
Lists: pgsql-novice
On Wed, 2002-06-19 at 03:24, John Taylor wrote:
> On Tuesday 18 June 2002 23:51, Ron Johnson wrote:
> > On Tue, 2002-06-18 at 10:36, Josh Berkus wrote:
> > > John,
> > > 
> > > > I'm optimising my data load by dropping indexes.
> > > > 
> > > > My question is, what do I do with the indexes created by postgres for
> > > > primary keys ?
> > > > 
> > > > Is it OK to drop them ?
> > > 
> > > No.
> > 
> > I've done it many times...
> > 
> > alter table t_lane_tx 
> >     add constraint c_lane_tx_pk primary key (lane_tx_id);
> > 
> > > > How do I create them again afterwards, so that they are used
> > > > correctly for constraint checking ?
> > 
> > In this instance, you can have speed or you can have correctness.
> > Pick one.  Of course, if you know that your input data is good,
> > you have both...
> > 
> 
> I think I'm going to assume that my data is good, otherwise the load will take about 30 hours !
> 
> So do I need to:
>   remove the constraint

Creating a PK constraint implicitly creates an index with the
same name.  So, drop the "same named" index and the PK constraint
will go away...

>   load
>   add the constraint
> or
>   drop index

See above...

>   load
>   add the constraint
> 
> 
> ie:
>   Will removing the constraint automatically drop the index
> 
>   Will dropping the index remove the constraint

The docs are pretty clear about it...

-- 
+-------------------------------------------------------------+
| Ron Johnson, Jr.        Home: ron(dot)l(dot)johnson(at)cox(dot)net         |
| Jefferson, LA  USA      http://ronandheather.dhs.org:81     |
|                                                             |
| "Object-oriented programming is an exceptionally bad idea   |
|  which could only have originated in California."           |
|  --Edsger Dijkstra                                          |
+-------------------------------------------------------------+


In response to

Responses

pgsql-novice by date

Next:From: Manfred KoizarDate: 2002-06-19 12:00:26
Subject: Re: [repost] trigger update time
Previous:From: Rory Campbell-LangeDate: 2002-06-19 08:36:34
Subject: [repost] trigger update time

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group