From: Philip Warner <pjw@rhyme.com.au>
To: pginfo <pginfo@t1.unisoftbg.com>
To: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: Re: problem with max and not using index on PK
Date: Sat, 03 May 2003 22:04:59 +1000
Message-ID: <5.1.0.14.0.20030503220308.02bcfe68@mail.rhyme.com.au> (raw)
In-Reply-To: <3EB387F6.F3230162@t1.unisoftbg.com>
At 11:12 AM 3/05/2003 +0200, pginfo wrote:
>I do not know the reason for not using index in this case.
PostgreSQL does not know that it can use the index, and the query example
you gave is about the only case in which it can use the index. You can get
it to use an index by rewriting it as:
select IDS from t_sk10 order by IDS desc limit 1;
...nowhere near as nice, but it works.
----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.B.N. 75 008 659 498) | /(@) ______---_
Tel: (+61) 0500 83 82 81 | _________ \
Fax: (+61) 03 5330 3172 | ___________ |
Http://www.rhyme.com.au | / \|
| --________--
PGP key available upon request, | /
and from pgp5.ai.mit.edu:11371 |/
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-sql@postgresql.org
Cc: pjw@rhyme.com.au, pginfo@t1.unisoftbg.com
Subject: Re: problem with max and not using index on PK
In-Reply-To: <5.1.0.14.0.20030503220308.02bcfe68@mail.rhyme.com.au>
* 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