Re: Feedback about Drupal SQL debugging - Mailing list pgsql-hackers

From Stephen Frost
Subject Re: Feedback about Drupal SQL debugging
Date
Msg-id 20090822010904.GX23840@tamriel.snowman.net
Whole thread Raw
In response to Re: Feedback about Drupal SQL debugging  (Greg Stark <gsstark@mit.edu>)
Responses Re: Feedback about Drupal SQL debugging  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Feedback about Drupal SQL debugging  (Greg Stark <gsstark@mit.edu>)
List pgsql-hackers
* Greg Stark (gsstark@mit.edu) wrote:
> You would have to specify the key. I think typically you would have
> something like:
>
> SELECT a.*, sum(b.col)
>    FROM a,b
>  GROUP BY a.pk

Ahhh, ok, this makes more sense.  This is SQL standard?  Do we have a
TODO for it?

> The database knows that it can use those values from any output row of
> the group since they'll all come from the same orginal row of a. Or
> possibly it could use some plan that doesn't involve multiplying that
> data in the first place.

Right.  It strikes me as a relativly small amount of work to get the
initial "just add the columns to the group by" logic implemented.  I'd
start from exactly where that ERROR comes from, to minimize any
performance hit from having to go figure out if the columns in the GROUP
BY comprise a key.  Doing something different in the planner based on
that could come later, if necessary.

I havn't looked at any code yet, but those who are familiar with these
areas- any gotchas you can think of off-hand to make this more difficult
than I'm hoping it is?
Thanks,
    Stephen

pgsql-hackers by date:

Previous
From: Greg Stark
Date:
Subject: Re: Feedback about Drupal SQL debugging
Next
From: Bruce Momjian
Date:
Subject: Re: revised hstore patch