Re: TABLESAMPLE doesn't actually satisfy the SQL spec, does it?

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: TABLESAMPLE doesn't actually satisfy the SQL spec, does it?
Date: 2015-07-12 16:57:15
Message-ID: CA+TgmoY4KrXNPys7mzxracP8Rr4NDPMEfM+sZgLT6gjKxA-MYw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Jul 12, 2015 at 12:02 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Merlin Moncure 2015-07-12 16:57:42 Re: [PATCH] Generalized JSON output functions
Previous Message Noah Misch 2015-07-12 16:17:19 TRANSFORM modules vs. AIX