pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: pginfo <pginfo@t1.unisoftbg.com>
To: Philip Warner <pjw@rhyme.com.au>
Cc: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: Re: problem with max and not using index on PK
Date: Sat, 03 May 2003 14:36:48 +0200
Message-ID: <3EB3B7E0.5E6030AE@t1.unisoftbg.com> (raw)
References: <5.1.0.14.0.20030503220308.02bcfe68@mail.rhyme.com.au>

It is working in this case.
I see that using "order by" make the query slower by 25% if I start it on
another column.

Alse as I wrote in oracle the max use indexes.

regards,
ivan.

Philip Warner wrote:

> 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   |/




view thread (3+ messages)

Message-ID: <3EB3B7E0.5E6030AE@t1.unisoftbg.com>
Permalink:  ../3EB3B7E0.5E6030AE@t1.unisoftbg.com/
Also on:    postgresql.org/message-id/3EB3B7E0.5E6030AE@t1.unisoftbg.com

 · 

reply

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: pginfo@t1.unisoftbg.com, pjw@rhyme.com.au
  Subject: Re: problem with max and not using index on PK
  In-Reply-To: <3EB3B7E0.5E6030AE@t1.unisoftbg.com>

* 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