Re: Parallel append plan instability/randomness

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Parallel append plan instability/randomness
Date: 2018-01-08 15:58:13
Message-ID: CA+TgmoaAWXyFUY1BgkYcH3DE4Xrot1qPgAOLW2Gj8OgQOVNg0w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Jan 7, 2018 at 11:40 PM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> One theory that can explain above failure is that the costs of
> scanning some of the sub-paths is very close due to which sometimes
> the results can vary. If that is the case, then probably using
> fuzz_factor in costs comparison (as is done in attached patch) can
> improve the situation, may be we have to consider some other factors
> like number of rows in each subpath.

This isn't an acceptable solution because sorting requires that the
comparison operator satisfy the transitive property; that is, if a = b
and b = c then a = c. With your proposed comparator, you could have a
= b and b = c but a < c. That will break stuff.

It seems like the obvious fix here is to use a query where the
contents of the partitions are such that the sorting always produces
the same result. We could do that either by changing the query or by
changing the data in the partitions or, maybe, by inserting ANALYZE
someplace.

--
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 Tom Lane 2018-01-08 16:01:53 Buildfarm status monitoring (was Re: pgsql: Implement channel binding tls-server-end-point for SCRAM)
Previous Message Simon Riggs 2018-01-08 15:44:11 Re: pgsql: Implement channel binding tls-server-end-point for SCRAM