X-Original-To: pgsql-admin@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id ADAE3475461 for ; Thu, 27 Feb 2003 23:35:54 -0500 (EST) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with SMTP id 70659-06 for ; Thu, 27 Feb 2003 23:35:36 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id B6504475C3D for ; Thu, 27 Feb 2003 23:24:08 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id h1S4OC5u001979; Thu, 27 Feb 2003 23:24:12 -0500 (EST) To: Bob Smith Cc: pgsql-sql Subject: Re: Transaction isolation and UNION queries In-reply-to: <0A27C204-4AC6-11D7-978F-0003933DD370@h-e.com> References: <0A27C204-4AC6-11D7-978F-0003933DD370@h-e.com> Comments: In-reply-to Bob Smith message dated "Thu, 27 Feb 2003 18:40:46 -0800" Date: Thu, 27 Feb 2003 23:24:11 -0500 Message-ID: <1978.1046406251@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new X-Archive-Number: 200302/447 X-Sequence-Number: 7645 Bob Smith 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