pgsql: Speed up match_eclasses_to_foreign_key_col() when there are many

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Speed up match_eclasses_to_foreign_key_col() when there are many
Date: 2019-02-21 01:53:25
Message-ID: E1gwdYD-0006Ga-MB@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Speed up match_eclasses_to_foreign_key_col() when there are many ECs.

Check ec_relids before bothering to iterate through the EC members.
On a perhaps extreme, but still real-world, query in which
match_eclasses_to_foreign_key_col() accounts for the bulk of the
planner's runtime, this saves nearly 40% of the runtime. It's a bit
of a stopgap fix, but it's simple enough to be back-patched to 9.6
where this code came in; so let's do that.

David Rowley

Discussion: https://postgr.es/m/6970.1545327857@sss.pgh.pa.us

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/e22bfe94e4dfc9abedf17026c3081bca9877163d

Modified Files
--------------
src/backend/optimizer/path/equivclass.c | 8 ++++++++
1 file changed, 8 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2019-02-21 14:56:26 pgsql: Fix dbtoepub output file name
Previous Message Andrew Gierth 2019-02-20 22:01:47 pgsql: Use an unsigned char for bool if we don't use the native bool.