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

pgsql: When we have successfully optimized a MIN or MAX aggregate into

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: When we have successfully optimized a MIN or MAX aggregate into
Date: 2008-03-27 19:06:23
Message-ID: 20080327190623.3B4307558E7@cvs.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Log Message:
-----------
When we have successfully optimized a MIN or MAX aggregate into an indexscan,
the query result must be exactly one row (since we don't do this when there's
any GROUP BY).  Therefore any ORDER BY or DISTINCT attached to the query is
useless and can be dropped.  Aside from saving useless cycles, this protects
us against problems with matching the hacked-up tlist entries to sort clauses,
as seen in a bug report from Taiki Yamaguchi.  We might need to work harder
if we ever try to optimize grouped queries with this approach, but this
solution will do for now.

Tags:
----
REL8_3_STABLE

Modified Files:
--------------
    pgsql/src/backend/optimizer/plan:
        planner.c (r1.226 -> r1.226.2.1)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/planner.c?r1=1.226&r2=1.226.2.1)

pgsql-committers by date

Next:From: Bruce MomjianDate: 2008-03-27 20:31:05
Subject: pgsql: Add URL for: * Consider allowing control of upper/lower case
Previous:From: Tom LaneDate: 2008-03-27 19:06:15
Subject: pgsql: When we have successfully optimized a MIN or MAX aggregate into

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