pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: sad <sad@bankir.ru>
To: Steve Crawford <scrawford@pinpointresearch.com>
To: pgsql-sql@postgresql.org
Subject: Re: locks and triggers. give me an advice please
Date: Wed, 21 Jul 2004 09:01:13 +0400
Message-ID: <200407210901.13421.sad@bankir.ru> (raw)
In-Reply-To: <200407201130.19676.scrawford@pinpointresearch.com>
References: <000001c46ddd$491501d0$c201a8c0@borderveygqj37>
	<200407200936.44292.sad@bankir.ru>
	<200407201130.19676.scrawford@pinpointresearch.com>

thnx.

i try to sound the idea to ensure myself that you are right.

> begin transaction;
> lock t1 in access exclusive mode;
>
> Turn off triggers and do your updates.
> (Note, "truncate t1" is faster than "delete from t1" followed by a
> "vacuum full" and you might consider running "reindex table t1" after
> your mass update or if appropriate drop your indexes, load the data,
> then recreate them.)
>
> Re-establish triggers.
>
> commit; --end of transaction unlocks the table

in case another user inserts a record into an adjuscent table with the value 
of reference field NOT IN t1.
the constraint causes reading of t1 to look up FK value IN t1.
so my EXCLUSIVE lock prevents even reading and this user operation will be 
queued.






view thread (3+ messages)

Message-ID: <200407210901.13421.sad@bankir.ru>
Permalink:  ../200407210901.13421.sad@bankir.ru/
Also on:    postgresql.org/message-id/200407210901.13421.sad@bankir.ru

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: sad@bankir.ru, scrawford@pinpointresearch.com
  Subject: Re: locks and triggers. give me an advice please
  In-Reply-To: <200407210901.13421.sad@bankir.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox