Question on indexes

Started by Emil Rachovskyover 20 years ago3 messagesgeneral
Jump to latest
#1Emil Rachovsky
zsevgymko@yahoo.com

Hi,
Can anyone show me a simple way of creating an index
in PostGre like that:
create index indName on someTable(someIntColumn DESC)
?

Thanks In Advance,
Emil

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

#2vishal saberwal
vishalsaberwal@gmail.com
In reply to: Emil Rachovsky (#1)
Re: Question on indexes

CREATE INDEX code_idx ON films(code) TABLESPACE indexspace;

http://www.postgresql.org/docs/8.1/interactive/sql-createindex.html

vish

Show quoted text

On 12/19/05, Emil Rachovsky <zsevgymko@yahoo.com> wrote:

Hi,
Can anyone show me a simple way of creating an index
in PostGre like that:
create index indName on someTable(someIntColumn DESC)
?

Thanks In Advance,
Emil

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

#3Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Emil Rachovsky (#1)
Re: [SQL] Question on indexes

Emil Rachovsky wrote:

Hi,
Can anyone show me a simple way of creating an index
in PostGre like that:
create index indName on someTable(someIntColumn DESC)
?

Not using that particular syntax, but you can do that if you create the
appropiate operator classes. Note that if you want to use btree index
on a single column, you don't need to have a descending index, because
btree indexes can be scanned in either direction. The opclass trick is
only needed if you want to have a multicolumn index. (I guess in the
other access methods it doesn't make much sense to think of descending
indexes.)

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.