From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Amit Kapila <amit.kapila@enterprisedb.com>
Cc: David Rowley <david.rowley@2ndquadrant.com>
Cc: Thomas Munro <thomas.munro@enterprisedb.com>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Subject: Re: ERROR: ORDER/GROUP BY expression not found in targetlist
Date: Mon, 13 Jun 2016 15:42:49 -0400
Message-ID: <1597.1465846969@sss.pgh.pa.us> (raw)
In-Reply-To: <20756.1465834072@sss.pgh.pa.us>
References: <CAEepm=1P94ca18KdQK_uLyAG521mqfF4My5MkFSftCxYuJZYgw@mail.gmail.com>
<CAKJS1f9vi6V9Fh=sHkOxXuLkmY7V8nUdQe27ELwWwxXv9Z6g8Q@mail.gmail.com>
<CAA4eK1Jm6HrJAPX26xyLGWes++r5=dOyOGRWeTa4q8NKd-UhVQ@mail.gmail.com>
<CA+TgmobBRacuT1JRpG5kH0UZCL5XXKb7wEXhe7EcX9VQdqqWkA@mail.gmail.com>
<15695.1465827695@sss.pgh.pa.us>
<CA+kptmAGnsCOQR6LvfPpiF7iBN79No6jXpkvcCJ2v9GGbrtu2Q@mail.gmail.com>
<17170.1465830165@sss.pgh.pa.us>
<20756.1465834072@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
I wrote:
> ... there was also an unexplainable plan change:
> *** /home/postgres/pgsql/src/test/regress/expected/aggregates.out Thu Apr 7 21:13:14 2016
> --- /home/postgres/pgsql/src/test/regress/results/aggregates.out Mon Jun 13 11:54:01 2016
> ***************
> *** 577,590 ****
> explain (costs off)
> select max(unique1) from tenk1 where unique1 > 42000;
> ! QUERY PLAN
> ! ---------------------------------------------------------------------------
> ! Result
> ! InitPlan 1 (returns $0)
> ! -> Limit
> ! -> Index Only Scan Backward using tenk1_unique1 on tenk1
> ! Index Cond: ((unique1 IS NOT NULL) AND (unique1 > 42000))
> ! (5 rows)
> select max(unique1) from tenk1 where unique1 > 42000;
> max
> --- 577,588 ----
> explain (costs off)
> select max(unique1) from tenk1 where unique1 > 42000;
> ! QUERY PLAN
> ! ----------------------------------------------------
> ! Aggregate
> ! -> Index Only Scan using tenk1_unique1 on tenk1
> ! Index Cond: (unique1 > 42000)
> ! (3 rows)
> select max(unique1) from tenk1 where unique1 > 42000;
> max
> I would not be surprised at a change to a parallel-query plan, but there's
> no parallelism here, so what happened? This looks like a bug to me.
> (Also, doing this query without COSTS OFF shows that the newly selected
> plan actually has a greater estimated cost than the expected plan, which
> makes it definitely a bug.)
I looked into this and found that the costs are considered fuzzily the
same, and then add_path prefers the slightly-worse path on the grounds
that it is marked parallel_safe while the MinMaxAgg path is not. It seems
to me that there is some fuzzy thinking going on there. On exactly what
grounds is a path to be preferred merely because it is parallel safe, and
not actually parallelized? Or perhaps the question to ask is whether a
MinMaxAgg path can be marked parallel-safe.
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, robertmhaas@gmail.com, amit.kapila@enterprisedb.com, david.rowley@2ndquadrant.com, thomas.munro@enterprisedb.com
Subject: Re: ERROR: ORDER/GROUP BY expression not found in targetlist
In-Reply-To: <1597.1465846969@sss.pgh.pa.us>
References: <CAEepm=1P94ca18KdQK_uLyAG521mqfF4My5MkFSftCxYuJZYgw@mail.gmail.com> <CAKJS1f9vi6V9Fh=sHkOxXuLkmY7V8nUdQe27ELwWwxXv9Z6g8Q@mail.gmail.com> <CAA4eK1Jm6HrJAPX26xyLGWes++r5=dOyOGRWeTa4q8NKd-UhVQ@mail.gmail.com> <CA+TgmobBRacuT1JRpG5kH0UZCL5XXKb7wEXhe7EcX9VQdqqWkA@mail.gmail.com> <15695.1465827695@sss.pgh.pa.us> <CA+kptmAGnsCOQR6LvfPpiF7iBN79No6jXpkvcCJ2v9GGbrtu2Q@mail.gmail.com> <17170.1465830165@sss.pgh.pa.us> <20756.1465834072@sss.pgh.pa.us> <1597.1465846969@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox