Re: Partitioned tables and relfilenode

From: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
To: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Partitioned tables and relfilenode
Date: 2017-02-22 08:20:42
Message-ID: 9be09bd2-6cda-f68a-5992-8e8e53a56f51@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2017/02/21 22:21, Ashutosh Bapat wrote:
> Some comments about 0003 patch.
>
> @@ -996,10 +996,20 @@ inheritance_planner(PlannerInfo *root)
> Index rti;
> + RangeTblEntry *parent_rte;
> There's already another variable declared in that function within a loop
> foreach(lc, root->append_rel_list)
> {
> ...
> RangeTblEntry *parent_rte;
> RangeTblEntry *child_rte;
>
> You might want to choose a different name or delete the one within the loop.

Deleted the one within the loop.

> I am wondering whether we should deal with inh flat reset in a
> slightly different way. Let expand_inherited_rtentry() mark inh =
> false for the partitioned tables without any partitions and deal with
> those at the time of estimating size by marking those as dummy. That
> might be better than multiple changes here. I will try to cook up a
> patch soon for that.

Are thinking something along the lines of the attached rewritten patch
0003? I also tend to think that's probably a cleaner patch. Thanks for
the idea.

> Also we should add tests to make sure the scans on partitioned tables
> without any partitions do not get into problems. PFA patch which adds
> those tests.

I added the test case you suggest, but kept just the first one.

I am including the patches 0001 and 0002 to keep all patches being
discussed on this thread together.

Thanks,
Amit

Attachment Content-Type Size
0001-Partitioned-tables-are-empty-themselves.patch text/x-diff 12.9 KB
0002-Do-not-allocate-storage-for-partitioned-tables.patch text/x-diff 3.1 KB
0003-Avoid-creating-scan-nodes-for-partitioned-tables.patch text/x-diff 15.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro HORIGUCHI 2017-02-22 08:39:45 Re: asynchronous execution
Previous Message Joel Jacobson 2017-02-22 08:20:14 Re: GRANT EXECUTE ON FUNCTION foo() TO bar();