Re: Need help in setting optimal configuration for a huge

From: Tomasz Rybak <bogomips(at)post(dot)pl>
To: "Craig A(dot) James" <cjames(at)modgraph-usa(dot)com>
Cc: Kishore B <kishorebh(at)gmail(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Need help in setting optimal configuration for a huge
Date: 2005-10-23 17:17:56
Message-ID: 1130087877.6708.16.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-performance

Dnia 23-10-2005, nie o godzinie 09:31 -0700, Craig A. James napisał(a):
<cut>
> MIN() and MAX() -- These are surprisingly slow, because they seem to do a full table scan EVEN ON AN INDEXED COLUMN!
In 8.1 this is no true, see the changelog.

> I don't understand why, but happily there is an effective substitute:
>
> select mycolumn from mytable order by mycolumn limit 1; -- same as MIN()
>
> select mycolumn from mytable order by mycolumn desc limit 1; -- same as MAX()

In 8.1 these queries are equivalent:

select mycolumn from mytable order by mycolumn limit 1;
select min(mycolumn) from mytable;

--
Tomasz Rybak <bogomips(at)post(dot)pl>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Kishore B 2005-10-23 21:35:38 Re: Need help in setting optimal configuration for a huge database.
Previous Message Tom Lane 2005-10-23 17:06:07 Re: Need help in setting optimal configuration for a huge

Browse pgsql-performance by date

  From Date Subject
Next Message Josh Berkus 2005-10-23 21:02:35 Re: Using LIMIT 1 in plpgsql PERFORM statements
Previous Message Tom Lane 2005-10-23 17:06:07 Re: Need help in setting optimal configuration for a huge