Re: Suppressing unused subquery output columns

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Suppressing unused subquery output columns
Date: 2014-06-12 15:14:47
Message-ID: CA+TgmoaY+PLWNM-TQnP6uzJUJhhBL8vGeeiqftbo=pHgTXf3ww@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jun 5, 2014 at 10:27 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> The attached draft patch fixes this by deleting unused output expressions
> from unflattened subqueries, so that we get:
>
> regression=# explain select f1 from (select * from t1 left join t2 on f1=f2 limit 1) ss;
> QUERY PLAN
> ------------------------------------------------------------------
> Subquery Scan on ss (cost=0.00..0.02 rows=1 width=4)
> -> Limit (cost=0.00..0.01 rows=1 width=4)
> -> Seq Scan on t1 (cost=0.00..34.00 rows=2400 width=4)
> Planning time: 0.193 ms
> (4 rows)
>
> I'm not entirely convinced that it's worth the extra planning cycles,
> though. Given the small number of complaints to date, it might not
> be worth doing this. Thoughts?

I've encountered this issue before and think it would be great to fix
it. I'm not sure precisely how many cycles it's worth paying, but
definitely more than zero.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2014-06-12 15:19:06 Re: lo_create(oid, bytea) breaks every extant release of libpq
Previous Message Tom Lane 2014-06-12 15:13:48 Re: lo_create(oid, bytea) breaks every extant release of libpq