Re: BUG #15324: Non-deterministic behaviour from parallelised sub-query
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: Stephen Frost <sfrost@snowman.net>, Marko Tiikkaja <marko@joh.to>,
Andres Freund <andres@anarazel.de>,
Andrew Fletcher <andy@prestigedigital.com>,
PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Date: 2018-09-02T18:55:20Z
Lists: pgsql-bugs
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Don't allow LIMIT/OFFSET clause within sub-selects to be pushed to workers.
- 568b4e1fdeb3 9.6.11 landed
- 1ceb103e7d1e 10.6 landed
- 830d7565902f 11.0 landed
- 75f9c4ca5a80 12.0 landed
-
Back-patch "Fix parallel hash join path search."
- 271b678436ce 9.6.11 landed
-
Prohibit pushing subqueries containing window function calculation to
- f658235a448a 9.6.11 landed
- bf61873ae3b6 10.6 landed
- 14e9b2a752ef 12.0 landed
- 2ce253cf57b1 11.0 landed
-
Fix parallel hash join path search.
- 655393a022bd 10.0 cited
Amit Kapila <amit.kapila16@gmail.com> writes: > Tom, do you have input on this? Is it okay to backpatch this fix? Well, >> + * Treat window functions as parallel-restricted as the row ordering >> + * induced by them is non-deterministic. We can relax this condition for >> + * cases where the row ordering can be deterministic like when there is >> + * an ORDER BY on the primary key, but those cases don't seem to be >> + * interesting enough to have additional checks. This comment seems fairly confused. I'd say something like * Treat window functions as parallel-restricted because we aren't sure * whether the input row ordering is fully deterministic, and the output * of window functions might vary across workers if not. (In some cases, * like where the window frame orders by a primary key, we could relax * this restriction. But it doesn't currently seem worth expending extra * effort to do so.) >> In addition to the above, I have marked all built-in window functions >> as parallel-restricted. I think even if we don't do that something >> like above check should be sufficient, but OTOH, I don't see any >> reason to keep the marking of such functions as parallel-safe. Is >> there a reason, why we shouldn't mark them as parallel-restricted? I am *strongly* against this. It's unnecessary catalog churn that we might need to undo someday, and it confuses a property of the window function infrastructure with a property of individual window functions. As a counterexample, if a window function were parallel-unsafe for some reason, we'd surely need to honor that. More realistically, someone might add a window function that actually needs to be parallel-restricted for reasons of its own, but then there would be no obvious distinction between such a function and one that you'd hacked up to be marked parallel-restricted even though it's safe in itself. If we then do make the sort of optimization suggested in the comment, it's likely that someone would just s/r/s/g for all the window functions and thereby break such a function. Better to retain the correct per-function markings. regards, tom lane