Re: Restore v. Running COPY/INDEX seperatly - Mailing list pgsql-general

From Tom Lane
Subject Re: Restore v. Running COPY/INDEX seperatly
Date
Msg-id 12760.1188186185@sss.pgh.pa.us
Whole thread Raw
In response to Re: Restore v. Running COPY/INDEX seperatly  (Gregory Stark <stark@enterprisedb.com>)
Responses Re: Restore v. Running COPY/INDEX seperatly
Re: Restore v. Running COPY/INDEX seperatly
List pgsql-general
Gregory Stark <stark@enterprisedb.com> writes:
>> On Sun, 26 Aug 2007, Benjamin Arai wrote:
>>> So, I built my tables which contains a TSearch2 field by
>>> 1. Create table without indexes
>>> 2. COPY data into table
>>> 3. ALTER TABLE tblMessages ADD COLUMN idxFTI tsvector;
>>> 4. UPDATE tblMessages SET idxFTI=to_tsvector('default', strMessage);

> Or you could set up a trigger to generate the tsvector when you first
> load the data instead of adding it later.

You're going to want such a trigger anyway, so installing it before the
COPY step seems like the Obviously Right Thing.  Any other approach
implies rewriting the entire table after you've loaded it, with no
compensating advantage that I can see.

            regards, tom lane

pgsql-general by date:

Previous
From: Erik Jones
Date:
Subject: Re: SQL Diff ?
Next
From: Ow Mun Heng
Date:
Subject: Re: Insert or Replace or \copy (bulkload)