Re: [HACKERS] More on GROUP BY

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jan Wieck <jwieck(at)debis(dot)com>, PostgreSQL HACKERS <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] More on GROUP BY
Date: 1999-05-11 19:01:10
Message-ID: 199905111901.PAA21290@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> > Wouldn't it be better to have another field (resgroupno e.g.)
> > in the resdom which the GroupClause can reference? Then
> > changing the resno's or even replacing the entire expression
> > wouldn't hurt because make_subplanTargetList() could match
> > them this way and the expressions for the subplans can be
> > pulled out directly from the targetlist. And it would save
> > processing the group clauses in the rewriting because they
> > cannot contain Var nodes anymore and the entire list can be
> > ignored.
>
> I think I like better the idea of leaving the representation alone,
> but using equal() on the exprs to match groupclause items to targetlist
> entries. That way, manipulation of the targetlist can't accidentally
> cause the grouplist to look like it contains something different than
> what it should have. It doesn't bother me that the planner can fail
> if it is unable to match a group item to a targetlist item --- that's
> a good crosscheck that nothing's gone wrong. (But matching on just
> the resno is unsafe, as you said before.)

The real problem is that it is hard to keep all these items synchronized
as they pass around through the stages. I looked at the aggregates, and
it looks like that has a separate copy too, so it may not be that bad.
We may just be missing a pass that makes appropriate changes in GROUP
clauses, but I am not sure.

> I think it's true that using a TLE for each grouplist item is a waste of
> space, and that representing the grouplist as simply a list of expr's
> would be good enough. But pulling out the TLE decoration seems like
> it's not an appropriate use of time at this stage of the release cycle.
> I'd say hold off till after 6.5, then fold it in with the parsetree
> redesign that you keep muttering we need (I agree!).

Basically, it is my fault that I am bringing up the issue so late. If I
had done the Open Items list earlier, we would not be so close to the
final.

Jan is currently researching it, and we have the regression tests and
three weeks. He usually does a fine job of fixing things. Jan, find
out what you think is required to get this working, and if it is not too
bad, maybe we should go ahead.

What does the Aggreg do? Does it has similar duplication?

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vince Vielhaber 1999-05-11 19:03:10 RE: [HACKERS] web site addition
Previous Message Christopher Masto 1999-05-11 18:44:53 Re: [HACKERS] 6.5 TODO list