Re: Feedback about Drupal SQL debugging

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: Jean-Michel Pouré <jm(at)poure(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Feedback about Drupal SQL debugging
Date: 2009-08-22 01:09:04
Message-ID: 20090822010904.GX23840@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

* Greg Stark (gsstark(at)mit(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2009-08-22 01:13:35 Re: revised hstore patch
Previous Message Greg Stark 2009-08-22 01:01:35 Re: Feedback about Drupal SQL debugging