From: Tom Lane <tgl@sss.pgh.pa.us>
To: Craig A. James <cjames@modgraph-usa.com>
Cc: Kishore B <kishorebh@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Need help in setting optimal configuration for a huge
Date: Sun, 23 Oct 2005 13:06:07 -0400
Message-ID: <20903.1130087167@sss.pgh.pa.us> (raw)
In-Reply-To: <435BBAF0.8080500@modgraph-usa.com>
References: <42567e060510221415r2516523l4c3f9b42dee91a09@mail.gmail.com>
<435BBAF0.8080500@modgraph-usa.com>
"Craig A. James" <cjames@modgraph-usa.com> writes:
> MIN() and MAX() -- These are surprisingly slow, because they seem to do a full table scan EVEN ON AN INDEXED COLUMN! 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()
BTW, Postgres does know to do that for itself as of 8.1.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, cjames@modgraph-usa.com, kishorebh@gmail.com
Subject: Re: Need help in setting optimal configuration for a huge
In-Reply-To: <20903.1130087167@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox