Re: background triggers?

From: Kenneth Downs <ken(at)secdat(dot)com>
To: Rafal Pietrak <rafal(at)zorro(dot)isa-geek(dot)com>
Cc: Chris Browne <cbbrowne(at)acm(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: background triggers?
Date: 2006-05-24 11:41:26
Message-ID: 44744666.7020607@secdat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Rafal Pietrak wrote:

>A plain INSERT of batch takes 5-10minutes on desktop postgresql (800MHz
>machine, ATA disks). When I attach trigger (*Very* simple funciton) to
>update the accounts, the INSERT take hours (2-4). But when I make just
>one single update of all accounts at the end of the batch insert, it
>takes 20-30min.
>
>
>
Why not have the INSERT go to an "inbox" table, a table whose only job
is to receive the data for future processing.

Your client code should mark all rows with a batch number as they go
in. Then when the batch is loaded, simply invoke a stored procedure to
process them. Pass the stored procedure the batch number.

IOW, have your "background trigger" be a stored procedure that is
invoked by the client, instead of trying to get the server to do it.

Attachment Content-Type Size
ken.vcf text/x-vcard 186 bytes

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2006-05-24 12:22:21 Re: challenging constraint situation - how do I make it
Previous Message Sim Zacks 2006-05-24 11:36:18 Re: background triggers?