Re: Functional dependency in GROUP BY through JOINs
От | David Rowley |
---|---|
Тема | Re: Functional dependency in GROUP BY through JOINs |
Дата | |
Msg-id | 006001cdd42a$8e69dd70$ab3d9850$@gmail.com обсуждение исходный текст |
Ответ на | Re: Functional dependency in GROUP BY through JOINs ("Kevin Grittner" <kgrittn@mail.com>) |
Список | pgsql-hackers |
> From: Kevin Grittner [mailto:kgrittn@mail.com] > > I think I'm right in thinking that if a unique index exists to match > > the group by clause, and the join condition is equality (probably > > using the same operator class as the unique btree index?), then the > > grouping could be pushed up to before the join. > > Off-hand, it seems equivalent to me; I don't know how much work it would > be. > > Out of curiosity, does the first query's plan change if you run this instead?: > > SELECT s.product_code,SUM(s.quantity) > FROM products p > INNER JOIN bigsalestable s ON p.productid = s.productid GROUP BY > s.product_code; > I should have made it more clear about the lack of product_code in the bigsalestable, there's only productid, the lookupto the product table was to obtain the actual more user friendly product_code. The actual table def's are in the attachment of the original email. Regards David Rowley > -Kevin
В списке pgsql-hackers по дате отправления: