pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Martijn van Oosterhout <kleptog@gmail.com>
Cc: Richard Guo <guofenglinux@gmail.com>
Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #17564: Planner bug in combination of generate_series(), unnest() and ORDER BY
Date: Wed, 03 Aug 2022 17:53:30 -0400
Message-ID: <3243867.1659563610@sss.pgh.pa.us> (raw)
In-Reply-To: <CADWG95uxFuobe8AoXdYLCTzDBWo3JUkHS7m6J=X4m6qdn4CkTQ@mail.gmail.com>
References: <17564-c7472c2f90ef2da3@postgresql.org>
	<2184335.1659392231@sss.pgh.pa.us>
	<CADWG95s03YZsRy3+q0bQFXW_v_f-9vMvcFOo6KUL08DvqbXhqg@mail.gmail.com>
	<CAMbWs49AgGUophtyThqHhSUyDTu3h6oATg-7GgowCtvHWCh9qQ@mail.gmail.com>
	<3002973.1659538573@sss.pgh.pa.us>
	<CADWG95uxFuobe8AoXdYLCTzDBWo3JUkHS7m6J=X4m6qdn4CkTQ@mail.gmail.com>

Martijn van Oosterhout <kleptog@gmail.com> writes:
> The part I haven't seen explained is why the generate_series() is
> important. My guess is that if you replace it with an expression it is no
> longer an SRF and it produces some completely different plan that prevents
> the problematic path being triggered.

I think the generate_series() forces a ProjectSet to be put atop the
join, where we'd probably not have done that without it, having made
the bogus assumption that we could evaluate the sort-key SRF at scan
level.  Why that changes the costs enough to mask or not mask the bug
is still obscure.

			regards, tom lane





view thread (18+ messages)  latest in thread

Message-ID: <3243867.1659563610@sss.pgh.pa.us>
Permalink:  ../3243867.1659563610@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3243867.1659563610@sss.pgh.pa.us

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, kleptog@gmail.com, guofenglinux@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #17564: Planner bug in combination of generate_series(), unnest() and ORDER BY
  In-Reply-To: <3243867.1659563610@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