advanced index (descending and table-presorted descending)

Started by netsqlabout 19 years ago3 messages
#1netsql
cekvenich@gmail.com

Can pgSQL 8.x do descending indexes like mySQL 5.1?
(so 1st column is descending and rest are asscending?)

Can pgSQL 8.x do "physically" sorted table (like a forced index order) so we
don't need order by?

tia,
.V

#2Greg Mitchell
gmitchell@atdesk.com
In reply to: netsql (#1)
Re: advanced index (descending and table-presorted descending)

First off, not sure this is the right list for this question (maybe
GENERAL, but HACKERS is for server coding)....

Can pgSQL 8.x do descending indexes like mySQL 5.1?
(so 1st column is descending and rest are asscending?)

Not sure why you want this... But you could create an operator class
with the operators backward I believe (i.e. make less-than use
greater-than).

Can pgSQL 8.x do "physically" sorted table (like a forced index order)
so we don't need order by?

See man cluster(7).

Greg

#3Bruce Momjian
bruce@momjian.us
In reply to: Greg Mitchell (#2)
Re: [HACKERS] advanced index (descending and table-presorted

[ moved to General]

Greg Mitchell wrote:

First off, not sure this is the right list for this question (maybe
GENERAL, but HACKERS is for server coding)....

Can pgSQL 8.x do descending indexes like mySQL 5.1?
(so 1st column is descending and rest are asscending?)

Not sure why you want this... But you could create an operator class
with the operators backward I believe (i.e. make less-than use
greater-than).

We have a TODO for this:

* Allow the creation of indexes with mixed ascending/descending
specifiers

This is possible now by creating an operator class with reversed sort
operators. One complexity is that NULLs would then appear at the start
of the result set, and this might affect certain sort types, like
merge join.

--
Bruce Momjian bruce@momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +