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

Re: Triggers During COPY

From: Thomas F(dot)O'Connell <tfo(at)sitening(dot)com>
To: josh(at)agliodbs(dot)com
Cc: PgSQL - Performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Triggers During COPY
Date: 2005-01-28 17:17:23
Message-ID: a8db069c1646fcd04ce386895fea3735@sitening.com (view raw or flat)
Thread:
Lists: pgsql-performance
As far as dropping/recreating triggers, there seem to be two strategies:

1. Perform the drop-import-create operation in a transaction, thereby 
guaranteeing the accuracy of the counts but presumably locking the 
table during the operation, which could take many minutes (up to an 
hour or two) in extreme cases.

2. Drop the triggers, import, create the triggers, and update with the 
import count, recognizing that other updates could've occurred without 
accumulating updates during the import process, then later (nightly, 
maybe?) do a full update to recalibrate the counts. In this case the 
count( * ) involved could also lock the table for a bit pending the 
sequential scan(s) if the update is performed in a transaction. 
Otherwise, again, there is a realistic possibility of inaccurate counts 
occurring and persisting between calibrations.

Is there a best practice anywhere here?

-tfo

--
Thomas F. O'Connell
Co-Founder, Information Architect
Sitening, LLC
http://www.sitening.com/
110 30th Avenue North, Suite 6
Nashville, TN 37203-6320
615-260-0005

On Jan 27, 2005, at 11:41 PM, Josh Berkus wrote:

> Thomas,
>
>> Would it be absurd to drop the triggers during import and recreate 
>> them
>> afterward and update the counts in a summ> ary update based on
>> information from the import process?
>
> That's what I'd do.
>
> -- 
> --Josh
>
> Josh Berkus
> Aglio Database Solutions
> San Francisco


In response to

pgsql-performance by date

Next:From: Josh BerkusDate: 2005-01-28 17:48:31
Subject: Re: Triggers During COPY
Previous:From: PFCDate: 2005-01-28 17:14:14
Subject: Re: Bitmap indexes

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