From: Andres Freund <andres@anarazel.de>
To: David Rowley <dgrowleyml@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Scott Ribe <scott_ribe@elevated-dev.com>
Cc: PostgreSQL General <pgsql-general@lists.postgresql.org>
Subject: Re: bad JIT decision
Date: Tue, 28 Jul 2020 14:28:06 -0700
Message-ID: <20200728212806.tu5ebmdbmfrvhoao@alap3.anarazel.de> (raw)
In-Reply-To: <20200728210748.heyfzf7uv6n5ot3k@alap3.anarazel.de>
References: <7736C40E-6DB5-4E7A-8FE3-4B2AB8E22793@elevated-dev.com>
<CAApHDvoGfCqiF-20k4OLgawyubezBbpBpdfJ0SuphbbK0KEVUw@mail.gmail.com>
<629715.1595630222@sss.pgh.pa.us>
<CAApHDvoFsWpkwt+pKuuswChC+6EKQO+FfwicTQpSfTXAHDfoZw@mail.gmail.com>
<CAApHDvooanQOWLLcxStyqrCY9UAmxN35+e=EV=h-4r8XiCBUGA@mail.gmail.com>
<673332.1595688858@sss.pgh.pa.us>
<20200727230007.rpknq77f7aaiufq2@alap3.anarazel.de>
<CAApHDvrAnkzsyY-jkcgrh-WFFGmLH5A7g+Odo0cVJq2-S311-Q@mail.gmail.com>
<20200728210748.heyfzf7uv6n5ot3k@alap3.anarazel.de>
Hi,
On 2020-07-28 14:07:48 -0700, Andres Freund wrote:
> (I'm rebasing my tree that tries to reduce the overhead / allow caching
> / increase efficiency to current PG, but it's a fair bit of work)
FWIW, I created a demo workload for this, and repro'ed the issue with
that. Those improvements does make a very significant difference:
CREATE FUNCTION exec(text) returns text language plpgsql volatile
AS $f$
BEGIN
EXECUTE $1;
RETURN $1;
END;
$f$;
CREATE TABLE manypa(category text not null, data text not null) PARTITION BY LIST(category);
SELECT exec('CREATE TABLE manypa_'||g.i||' PARTITION OF manypa FOR VALUES IN('||g.i||')') FROM generate_series(1, 1000) g(i);
INSERT INTO manypa(category, data) VALUES('1', '1');
EXPLAIN ANALYZE SELECT * FROM manypa WHERE data <> '17' and data <> '15' and data <> '13' AND data <> '11' AND data <> '9' AND data <> '7' AND data <> '5' AND data <> '3' AND data <> '1';
Before:
Timing: Generation 335.345 ms, Inlining 51.025 ms, Optimization 11967.776 ms, Emission 9201.499 ms, Total 21555.645 ms
IR size: unoptimized: 9022868 bytes, optimized: 6206368 bytes
After:
Timing: Generation 261.283 ms, Inlining 30.875 ms, Optimization 1671.969 ms, Emission 18.557 ms, Total 1982.683 ms
IR size: unoptimized 8776100 bytes, optimized 115868 bytes
That obviously needs to be improved further, but it's already a lot
better. In particular after these changes the generated code could be
cached.
One thing that could make a huge difference here is to be able to
determine whether two expressions and/or tlists are equivalent
cheaply... I know that David has some need for that too.
Greetings,
Andres Freund
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: andres@anarazel.de, dgrowleyml@gmail.com, tgl@sss.pgh.pa.us, scott_ribe@elevated-dev.com
Subject: Re: bad JIT decision
In-Reply-To: <20200728212806.tu5ebmdbmfrvhoao@alap3.anarazel.de>
References: <7736C40E-6DB5-4E7A-8FE3-4B2AB8E22793@elevated-dev.com> <CAApHDvoGfCqiF-20k4OLgawyubezBbpBpdfJ0SuphbbK0KEVUw@mail.gmail.com> <629715.1595630222@sss.pgh.pa.us> <CAApHDvoFsWpkwt+pKuuswChC+6EKQO+FfwicTQpSfTXAHDfoZw@mail.gmail.com> <CAApHDvooanQOWLLcxStyqrCY9UAmxN35+e=EV=h-4r8XiCBUGA@mail.gmail.com> <673332.1595688858@sss.pgh.pa.us> <20200727230007.rpknq77f7aaiufq2@alap3.anarazel.de> <CAApHDvrAnkzsyY-jkcgrh-WFFGmLH5A7g+Odo0cVJq2-S311-Q@mail.gmail.com> <20200728210748.heyfzf7uv6n5ot3k@alap3.anarazel.de> <20200728212806.tu5ebmdbmfrvhoao@alap3.anarazel.de>
* 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