Re: refactoring allpaths.c (was Re: [HACKERS] Suppressing unused subquery output columns)

2014-07-25 Thread Etsuro Fujita
(2014/06/13 1:37), Tom Lane wrote: I wrote: We have a couple votes for this patch and no one has spoken against it, so I'll go ahead and push it into HEAD. BTW, I forgot to mention that while working on this patch I was thinking it's past time to separate out the subquery support in

Re: [HACKERS] Suppressing unused subquery output columns

2014-06-12 Thread Robert Haas
On Thu, Jun 5, 2014 at 10:27 PM, Tom Lane t...@sss.pgh.pa.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;

Re: [HACKERS] Suppressing unused subquery output columns

2014-06-12 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes: On Thu, Jun 5, 2014 at 10:27 PM, Tom Lane t...@sss.pgh.pa.us wrote: The attached draft patch fixes this by deleting unused output expressions from unflattened subqueries, so that we get: ... I'm not entirely convinced that it's worth the extra

refactoring allpaths.c (was Re: [HACKERS] Suppressing unused subquery output columns)

2014-06-12 Thread Tom Lane
I wrote: We have a couple votes for this patch and no one has spoken against it, so I'll go ahead and push it into HEAD. BTW, I forgot to mention that while working on this patch I was thinking it's past time to separate out the subquery support in allpaths.c into its own file. With this

Re: [HACKERS] Suppressing unused subquery output columns

2014-06-07 Thread David Rowley
On Fri, Jun 6, 2014 at 2:27 PM, Tom Lane t...@sss.pgh.pa.us wrote: 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? That's a difficult question for sure. Obviously it's

Re: [HACKERS] Suppressing unused subquery output columns

2014-06-06 Thread Jim Nasby
On 6/5/14, 9:54 PM, Tom Lane wrote: Rod Taylor rod.tay...@gmail.com writes: On Thu, Jun 5, 2014 at 10:27 PM, Tom Lane t...@sss.pgh.pa.us wrote: 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

[HACKERS] Suppressing unused subquery output columns

2014-06-05 Thread Tom Lane
A question in pgsql-general made me reflect about how the planner isn't smart about unreferenced output columns of subqueries that it's not able to flatten into the parent query. Here's an example: regression=# create table t1 (f1 int); CREATE TABLE regression=# create table t2 (f2 int primary

Re: [HACKERS] Suppressing unused subquery output columns

2014-06-05 Thread Rod Taylor
On Thu, Jun 5, 2014 at 10:27 PM, Tom Lane t...@sss.pgh.pa.us wrote: 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? Would this avoid execution of expensive functions in

Re: [HACKERS] Suppressing unused subquery output columns

2014-06-05 Thread Tom Lane
Rod Taylor rod.tay...@gmail.com writes: On Thu, Jun 5, 2014 at 10:27 PM, Tom Lane t...@sss.pgh.pa.us wrote: 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? Would this