pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Achilleus Mantzios <achill@matrix.gatewaynet.com>
To: Bruno Wolff III <bruno@wolff.to>
Cc: email lists <lists@darrenmackay.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: query not using index for descending records?
Date: Thu, 29 Jan 2004 17:01:43 +0200 (EET)
Message-ID: <Pine.LNX.4.44.0401291657210.10019-100000@matrix.gatewaynet.com> (raw)
In-Reply-To: <20040129140655.GA14885@wolff.to>

O kyrios Bruno Wolff III egrapse stis Jan 29, 2004 :

> On Thu, Jan 29, 2004 at 15:29:11 +0200,
>   Achilleus Mantzios <achill@matrix.gatewaynet.com> wrote:
> > O kyrios Bruno Wolff III egrapse stis Jan 29, 2004 :
> > 
> > As i see there was a thread
> > http://archives.postgresql.org/pgsql-hackers/2003-05/msg00762.php
> > dealing with this issue, assuming the "correct" order by
> > should be "order by datetime ASC, id DESC".
> 
> So you really didn't want them in the reverse order?

I am not the initiator of this thread,
i was just lurking :)

> 
> > Do you know of any progress for declaring the direction of each
> > column in a multicolumn index?
> 
> If you are using 7.4 you can use a functional index to get around this.
> Assuming id is a numeric type, you can make an index on datetime and
> (-id) and sort by datetime, -id and the index should get used.
> 
> This should still get fixed at some point, as this trick doesn't work
> for types for which the - operator exists. But I haven't heard of
> anyone working on it for 7.5, so don't expect a real fix any time soon.
> 

It would be nice to have this feature for varchar as well.

> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly
> 

-- 
-Achilleus




view thread (10+ messages)  latest in thread

Message-ID: <Pine.LNX.4.44.0401291657210.10019-100000@matrix.gatewaynet.com>
Permalink:  ../Pine.LNX.4.44.0401291657210.10019-100000@matrix.gatewaynet.com/
Also on:    postgresql.org/message-id/Pine.LNX.4.44.0401291657210.10019-100000@matrix.gatewaynet.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: achill@matrix.gatewaynet.com, bruno@wolff.to, lists@darrenmackay.com
  Subject: Re: query not using index for descending records?
  In-Reply-To: <Pine.LNX.4.44.0401291657210.10019-100000@matrix.gatewaynet.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