Re: Bidirectional index traversal

Поиск
Список
Период
Сортировка
От Alanoly Andrews
Тема Re: Bidirectional index traversal
Дата
Msg-id 09B23E7BF70425478C1330D893A722C602FEC01A2D@MailSVR.invera.com
обсуждение исходный текст
Ответ на Re: Bidirectional index traversal  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Bidirectional index traversal  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-admin
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
Ihave a query like: "select * from tab1 order by col1 desc", does the Postgres Optimizer use the same index as above
(butin 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
tohandle such cases? 

Alanoly.

-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: Thursday, September 16, 2010 10:57 AM
To: Alanoly Andrews
Cc: 'pgsql-admin@postgresql.org'
Subject: Re: [ADMIN] Bidirectional index traversal

Alanoly Andrews <alanolya@invera.com> 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.
Anydistribution, 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.
Toutediffusion, 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. 
****************************************************


В списке pgsql-admin по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Bidirectional index traversal
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Bidirectional index traversal