Re: Patch for removng unused targets

From: Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>
To: Etsuro Fujita <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alexander Korotkov <aekorotkov(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Patch for removng unused targets
Date: 2013-06-19 16:28:45
Message-ID: CAP7QgmnETeD3QtPh82uwfUy0Wh1wiZbF-X7OrrBfTfvWVe3b-Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 19, 2013 at 4:49 AM, Etsuro Fujita
<fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp>wrote:

> Hi Harada-san,****
>
> ** **
>
> Thank you for the review.****
>
> ** **
>
> I think that the parse tree has enough information to do this optimization
> and that the easiest way to do it is to use the information, though I might
> not have understand your comments correctly. So, I would like to fix the
> bug by simply modifying the removability check in adjust_targetlist() so
> that the resjunk column is not used in GROUP BY, DISTINCT ON and *window
> PARTITION/ORDER BY*, besides ORDER BY. No? I am open to any comments.***
> *
>
>
>

I guess the patch works fine, but what I'm saying is it might be limited to
small use cases. Another instance of this that I can think of is ORDER BY
clause of window specifications, which you may want to remove from the
target list as well, in addition to ORDER BY of query. It will just not be
removed by this approach, simply because it is looking at only
parse->sortClause. Certainly you can add more rules to the new function to
look at the window specification, but then I'm not sure what we are
missing. So, as it stands it doesn't have critical issue, but more
generalized approach would be desirable. That said, I don't have strong
objection to the current patch, and just posting one thought to see if
others may have the same opinion.

Thanks,
--
Hitoshi Harada

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Cédric Villemain 2013-06-19 16:32:19 Re: Bugfix and new feature for PGXS
Previous Message Andrew Dunstan 2013-06-19 16:20:11 Re: Bugfix and new feature for PGXS