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

Re: slow plan for min/max

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: Pailloncy Jean-Gérard <pailloncy(at)ifrance(dot)com>
Cc: <pgsql-performance(at)postgresql(dot)org>
Subject: Re: slow plan for min/max
Date: 2003-09-08 15:56:28
Message-ID: Pine.LNX.4.33.0309080954020.11520-100000@css120.ihs.com (view raw or flat)
Thread:
Lists: pgsql-performance
On Sun, 7 Sep 2003, Pailloncy Jean-Gérard wrote:

Asking a question about why max(id) is so much slower than select id order 
by id desc limit 1, Pailloncy said:

> I ask for the same thing.
> That's better !

This is a Frequently asked question about something that isn't likely to 
change any time soon.

Basically, Postgresql uses an MVCC locking system that makes massively 
parallel operation possible, but costs in certain areas, and one of those 
areas is aggregate performance over large sets.  MVCC makes it very hard 
to optimize all but the simplest of aggregates, and even those 
optimzations which are possible would wind up being quite ugly at the 
parser level.

You might want to search the archives in the last couple years for this 
subject, as it's come up quite often.


In response to

Responses

pgsql-performance by date

Next:From: Neil ConwayDate: 2003-09-08 18:49:12
Subject: Re: slow plan for min/max
Previous:From: Shridhar DaithankarDate: 2003-09-08 14:50:35
Subject: Re: Serious issues with CPU usage

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