pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedTransaction isolation and UNION queries
2+ messages / 2 participants
[nested] [flat]
* Transaction isolation and UNION queries
@ 2003-02-28 02:40 Bob Smith <bsmith@h-e.com>
0 siblings, 1 reply; 2+ messages in thread
From: Bob Smith @ 2003-02-28 02:40 UTC (permalink / raw)
To: pgsql-admin
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?
Thanks!
Bob Smith
Hammett & Edison, Inc.
bsmith@h-e.com
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Transaction isolation and UNION queries
@ 2003-02-28 04:24 Tom Lane <tgl@sss.pgh.pa.us>
parent: Bob Smith <bsmith@h-e.com>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2003-02-28 04:24 UTC (permalink / raw)
To: Bob Smith <bsmith@h-e.com>; +Cc: pgsql-admin
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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2003-02-28 04:24 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-02-28 02:40 Transaction isolation and UNION queries Bob Smith <bsmith@h-e.com>
2003-02-28 04:24 ` Tom Lane <tgl@sss.pgh.pa.us>
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