Re: Are identical subqueries in unioned statements nonrepeatable?

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Derrick Rice <derrick(dot)rice(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Are identical subqueries in unioned statements nonrepeatable?
Date: 2010-07-22 18:39:02
Message-ID: 1279823866-sup-7923@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Excerpts from Derrick Rice's message of jue jul 22 12:27:31 -0400 2010:

> Is it possible for the contents of reference_table to differ from the first
> select to the select on the right hand side of the union? (e.g. because
> some other transaction committed additional rows).

No.

> If it is not possible, why? Is it because a single query always executes
> with serializable (effective) isolation?

Yes. (Actually: it's because a query is always executed with a single
snapshot).

> Is it because postgresql
> recognizes that the query is repeated and uses a single result set in both
> sides of the union?

No.

> Is this behavior that is part of postgresql intentionally, or a side effect
> that I should not rely on?

It is intentional and will not be changed.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2010-07-22 19:20:07 Re: Insert and Retrieve unsigned char sequences using C
Previous Message Scott Marlowe 2010-07-22 18:37:03 Re: How to improve performance in reporting database?