pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: David Rowley <david.rowley@2ndquadrant.com>
Cc: Dmitry Dolgov <9erthalion6@gmail.com>
Cc: Jeff Janes <jeff.janes@gmail.com>
Cc: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>
Cc: Pavel Stehule <pavel.stehule@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: why partition pruning doesn't work?
Date: Wed, 18 Jul 2018 09:32:52 -0400
Message-ID: <7500.1531920772@sss.pgh.pa.us> (raw)
In-Reply-To: <ab10ce44-18b0-244a-c9c8-67d7020e2ba9@lab.ntt.co.jp>
References: <CAFj8pRBjrufA3ocDm8o4LPGNye9Y+pm1b9kCwode4X04CULG3g@mail.gmail.com>
	<21787.1528428171@sss.pgh.pa.us>
	<17850.1528755844@sss.pgh.pa.us>
	<CA+Tgmoa2Vvka6dBMb2w_u_N2o2HUPY6oYkS4FQ3nXMj=4Zd5ig@mail.gmail.com>
	<19365.1528820758@sss.pgh.pa.us>
	<CA+TgmoZi9hwHb4nZxCeh1TTT8rGq6AYN1Q8o5uXhiPZ3sr6o9g@mail.gmail.com>
	<30981.1528822481@sss.pgh.pa.us>
	<CA+TgmoZXtauTcAHiTdL9dRShkK+ieLgNtiuxWxYZWJpHB41iWQ@mail.gmail.com>
	<637.1528863347@sss.pgh.pa.us>
	<CA+TgmoaQ+hxgDP4uxP_nRgC+JAn33_vona8P+GAnRDkceSZNSw@mail.gmail.com>
	<28597.1528900759@sss.pgh.pa.us>
	<ee1a67dc-69a1-b475-f812-3efe91509e32@lab.ntt.co.jp>
	<CAKJS1f-Dqc_J5=Ukkmr! kz_RoN_Lq+vzzppfDE51K7ACRo1rqqQ@mail.gmail.com>
	<CA+TgmoajU5mPAvgGqST_iiW6P-Y2T3mAmSfCAw2GEtYi0KQCJg@mail.gmail.com>
	<27099.1528987211@sss.pgh.pa.us>
	<56f1556c-6d6e-aaf8-de4f-a790a1efa5a3@l! ab.ntt.co.jp>
	<29987.1529341511@sss.pgh.pa.us>
	<b804d3a6-1411-660d-! a893-e2bf78231a9f@lab.ntt.co.jp>
	<4114.1531674142@sss.pgh.pa.us>
	<ab10ce44-18b0-244a-c9c8-67d7020e2b! a9@lab.ntt.co.jp>

Amit Langote <Langote_Amit_f8@lab.ntt.co.jp> writes:
> On 2018/07/16 2:02, Tom Lane wrote:
>> BTW, there'd be a lot to be said for having InitPlan just open all
>> the rels and build an array of Relation pointers that parallels the
>> RTE list, rather than doing heap_opens in random places elsewhere.

> +1 to this.  Actually I had written such a patch in place of the one I
> posted on this thread, but wasn't confident enough that I had found and
> fixed all the places in the executor that would use the Relation pointer
> from there instead of fetching it themselves.

Well, it doesn't have to be a 100% conversion, especially not to start
out with.  As long as we ensure that common code paths through the
executor have only one open/close per rel, I don't think it matters
too much if there are some corner cases with more.

Also, tracking down places like that wouldn't be that hard to do.  One
could instrument the relcache to report situations where a rel's refcount
gets above 1.  (The infrastructure for logging backtraces that's being
discussed in other threads would help here.)  We might decide that
particular cases weren't worth fixing --- eg if the extra open is
happening in code that doesn't have easy access to the EState --- but
I doubt that finding them is impractical.

			regards, tom lane




view thread (72+ messages)

Message-ID: <7500.1531920772@sss.pgh.pa.us>
Permalink:  ../7500.1531920772@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/7500.1531920772@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-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, Langote_Amit_f8@lab.ntt.co.jp, robertmhaas@gmail.com, david.rowley@2ndquadrant.com, 9erthalion6@gmail.com, jeff.janes@gmail.com, ashutosh.bapat@enterprisedb.com, pavel.stehule@gmail.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: why partition pruning doesn't work?
  In-Reply-To: <7500.1531920772@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