pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bob Smith <bsmith@h-e.com>
Cc: pgsql-sql <pgsql-admin@postgresql.org>
Subject: Re: Transaction isolation and UNION queries
Date: Thu, 27 Feb 2003 23:24:11 -0500
Message-ID: <1978.1046406251@sss.pgh.pa.us> (raw)
In-Reply-To: <0A27C204-4AC6-11D7-978F-0003933DD370@h-e.com>
References: <0A27C204-4AC6-11D7-978F-0003933DD370@h-e.com>

Bob Smith <bsmith@h-e.com> writes:
> I have a question about transaction isolation that I can't find an 
> answer to in the docs.  I'm working with a database that has some data 
> split over two tables.  One table is the ultimate destination for all 
> the data, the other is a "pending" table which holds rows during data 
> entry.  Rows from the pending table are moved to the permanent table 
> once data entry is complete.  For some purposes I want to see rows from 
> both tables, so I do a UNION.  My question is, with only read committed 
> isolation, could a commit by another transaction make changes appear 
> between the separate parts of the UNION query?  In other words, could a 
> row appear to be missing or duplicated because a transaction that was 
> moving the row from pending to permanent committed while the UNION was 
> running?

Should be okay as long as you retrieve the data in a single UNION select
--- or even multiple selects, if you put them into a single
serializable-mode transaction.  But not multiple select commands in a
read-committed transaction --- in RC mode you will recognize concurrent
commits at each command boundary.

			regards, tom lane



view thread (2+ messages)

Message-ID: <1978.1046406251@sss.pgh.pa.us>
Permalink:  ../1978.1046406251@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1978.1046406251@sss.pgh.pa.us

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, bsmith@h-e.com
  Subject: Re: Transaction isolation and UNION queries
  In-Reply-To: <1978.1046406251@sss.pgh.pa.us>
  References: <0A27C204-4AC6-11D7-978F-0003933DD370@h-e.com> <1978.1046406251@sss.pgh.pa.us>

* 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