Skip site navigation (1) Skip section navigation (2)

Optimization of unnecessary GROUP BY columns

From: Kevin Murphy <murphy(at)genome(dot)chop(dot)edu>
To: pgsql-general(at)postgresql(dot)org
Subject: Optimization of unnecessary GROUP BY columns
Date: 2006-12-26 17:08:04
Message-ID: 459156F4.7050207@genome.chop.edu (view raw or flat)
Thread:
Lists: pgsql-general
When columns are required in a GROUP BY clause even though some of them 
are fully dependent on others, is there any plan for making it possible 
to do the GROUP BY only on the necessary columns?  The 8.X documentation 
made me curious:

Section 7.2.3 in the 8.X documentation ("The GROUP BY and HAVING Clauses"):

"SELECT product_id, p.name, (sum(s.units) * p.price) AS sales
FROM products p LEFT JOIN sales s USING (product_id)
GROUP BY product_id, p.name, p.price;
...
Depending on how exactly the products table is set up, name and price 
may be fully dependent on the product ID, so the additional groupings 
could theoretically be unnecessary, but this is not implemented yet."

-Kevin Murphy


Responses

pgsql-general by date

Next:From: Martijn van OosterhoutDate: 2006-12-26 17:13:52
Subject: Re: Optimization of unnecessary GROUP BY columns
Previous:From: Marc EvansDate: 2006-12-26 15:30:31
Subject: Re: Clustering & Load Balancing & Replication

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group