From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Scott Ribe <scott_ribe@elevated-dev.com>
Cc: David Rowley <dgrowleyml@gmail.com>
Cc: PostgreSQL General <pgsql-general@lists.postgresql.org>
Subject: Re: bad JIT decision
Date: Tue, 28 Jul 2020 15:47:36 -0400
Message-ID: <1236773.1595965656@sss.pgh.pa.us> (raw)
In-Reply-To: <20200728171913.o5ok5h5c6kbjncob@alap3.anarazel.de>
References: <690D93FA-4A30-422D-94C3-18A089B8AEFE@elevated-dev.com>
<20200727230256.GA31992@alvherre.pgsql>
<20200728171913.o5ok5h5c6kbjncob@alap3.anarazel.de>
Andres Freund <andres@anarazel.de> writes:
> On 2020-07-27 19:02:56 -0400, Alvaro Herrera wrote:
>>> I don't quite understand why is it that a table with 1000 partitions
>>> means that JIT compiles the thing 1000 times. Sure, it is possible that
>>> some partitions have a different column layout, but it seems an easy bet
>>> that most cases are going to have identical column layout, and so tuple
>>> deforming can be shared.
> No, that's not what happens. The issue rather is that at execution time
> there's simply nothing tying the partitioned parts of the query together
> from the executor POV. Each table scan gets its own expressions to
> evaluate quals etc. That's not a JIT specific thing, it's general.
I think what Alvaro is imagining is caching the results of compiling
tuple-deforming. You could hash on the basis of all the parts of the
tupdesc that the deforming compiler cares about, and then share the
compiled code across different relations with similar tupdescs.
That could win for lots-o-partitions cases, and it could win across
successive queries on the same relation, too.
Maybe the same principle could be applied to compiled expressions,
but it's less obvious that you'd get enough matches to win.
regards, tom lane
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-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, andres@anarazel.de, alvherre@2ndquadrant.com, scott_ribe@elevated-dev.com, dgrowleyml@gmail.com
Subject: Re: bad JIT decision
In-Reply-To: <1236773.1595965656@sss.pgh.pa.us>
References: <690D93FA-4A30-422D-94C3-18A089B8AEFE@elevated-dev.com> <20200727230256.GA31992@alvherre.pgsql> <20200728171913.o5ok5h5c6kbjncob@alap3.anarazel.de> <1236773.1595965656@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