Re: Bidirectional index traversal

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



To expand on that question:

Suppose I have a table with the following schema: 
     tab1(col1 decimal(3,0), col2 char(3)).
There is an index defined on it as : create index tab1ind1 on tab1(col1)

Now, if I have a query as: "select * from tab1 order by col1", I expect the Optimizer to use the index tab1ind1. But if I have a query like: "select * from tab1 order by col1 desc", does the Postgres Optimizer use the same index as above (but in the reverse direction) or does it need to a full table scan and then sort values in col1 in the descending order? If the former, then there is bidirectional index traversal. That example was for a numeric field. What about character, date and timestamp fields? Does bidirectional index traversal exist, or do we need to create a second index to handle such cases?

Alanoly.

-----Original Message-----
From: Tom Lane [mailto:tgl@xxxxxxxxxxxxx] 
Sent: Thursday, September 16, 2010 10:57 AM
To: Alanoly Andrews
Cc: 'pgsql-admin@xxxxxxxxxxxxxx'
Subject: Re:  Bidirectional index traversal 

Alanoly Andrews <alanolya@xxxxxxxxxx> writes:
> I'd like to know whether Postgres (8.4) supports bidirectional traversal of indexes.

If you defined exactly what you meant by that, you might get useful
answers.  There are some features in there that might be what you mean,
or then again maybe not.

			regards, tom lane
****************************************************
This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately.
 
Ce courriel est confidentiel et protégé. L'expéditeur ne renonce pas aux droits et obligations qui s'y rapportent. Toute diffusion, utilisation ou copie de ce message ou des renseignements qu'il contient par une personne autre que le (les) destinataire(s) désigné(s) est interdite. Si vous recevez ce courriel par erreur, veuillez m'en aviser immédiatement, par retour de courriel ou par un autre moyen.
****************************************************


-- 
Sent via pgsql-admin mailing list (pgsql-admin@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux