Re: COPY ... FROM and index usage

From: Reg Me Please <regmeplease(at)gmail(dot)com>
To: Erik Jones <erik(at)myemma(dot)com>
Cc: "Josh Tolley" <eggyknap(at)gmail(dot)com>, "Postgres General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: COPY ... FROM and index usage
Date: 2007-11-04 15:26:49
Message-ID: 200711041626.49453.regmeplease@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Il Sunday 04 November 2007 16:21:41 Erik Jones ha scritto:
> On Nov 4, 2007, at 9:15 AM, Reg Me Please wrote:
> > Il Sunday 04 November 2007 14:59:10 Josh Tolley ha scritto:
> >> On 11/4/07, Reg Me Please <regmeplease(at)gmail(dot)com> wrote:
> >>> Hi all.
> >>>
> >>> I'd like to know whether the indexes on a table are updated or
> >>> not during
> >>> a "COPY ... FROM" request.
> >>>
> >>> That is, should I drop all indexes during a "COPY ... FROM" in
> >>> order to
> >>> gain the maximum speed to load data?
> >>>
> >>> Thanks.
> >>
> >> Although questions of "which is faster" often depend very heavily on
> >> the data involved, the database schema, the hardware, etc., typically
> >> people find it best to drop all indexes during a large import and
> >> recreate them afterward.
> >>
> >> - Josh/eggyknap
> >
> > This sounds very reasonable to me.
> > But the first question remains unanswered:
> >
> > Are the indexes updated during the COPY ... FROM ?
>
> Of course. Why would think that data could be inserted into a table
> by any means without it updating the table's indexes? That would
> make the index worthless.
>
> Erik Jones
>
> Software Developer | Emma®
> erik(at)myemma(dot)com
> 800.595.4401 or 615.292.5888
> 615.292.0777 (fax)
>
> Emma helps organizations everywhere communicate & market in style.
> Visit us online at http://www.myemma.com

I do understand your remarks and would agree.
But I was thinking about the COPY...FROM request not
as a normal INSERT INTO.
If this were the case I could have been running a REINDEX TABLE.

--
Reg me Please

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Lew 2007-11-04 15:46:36 Re: What makes a Postgres DBA?
Previous Message Erik Jones 2007-11-04 15:21:41 Re: COPY ... FROM and index usage