Re: TABLESAMPLE doesn't actually satisfy the SQL spec, does it? - Mailing list pgsql-hackers

From Robert Haas
Subject Re: TABLESAMPLE doesn't actually satisfy the SQL spec, does it?
Date
Msg-id CA+TgmoY4KrXNPys7mzxracP8Rr4NDPMEfM+sZgLT6gjKxA-MYw@mail.gmail.com
Whole thread Raw
In response to TABLESAMPLE doesn't actually satisfy the SQL spec, does it?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: TABLESAMPLE doesn't actually satisfy the SQL spec, does it?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Sun, Jul 12, 2015 at 12:02 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> As best I can tell (evidence below), the SQL standard requires that if a
> single query reads a table with a TABLESAMPLE clause multiple times (say,
> because it's on the inside of a nestloop), then the exact same set of
> sampled rows are returned each time.

Hmm, I tend to agree that it would be good if it behaved that way.
Otherwise, it seems like the behavior could be quite surprising.
Generally, we don't want the set of tuples that can be seen by a query
to change during the query; that's one of the things that snapshot
isolation does for us, as compared with, say, a literal interpretation
of READ COMMITTED, which would behave as SnapshotNow used to do.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Noah Misch
Date:
Subject: TRANSFORM modules vs. AIX
Next
From: Merlin Moncure
Date:
Subject: Re: [PATCH] Generalized JSON output functions