Re: [PERFORM] Fwd: Index on table when using DESC clause

2005-05-23 Thread Steinar H. Gunderson
On Mon, May 23, 2005 at 07:41:19PM +0200, Yves Vindevogel wrote: However, when I query my db using for instance order by pages, documentname, it is very fast. If I use order by pages desc, documentname, it is not fast at all, like it is not using the index properly at all. Make an

Re: [PERFORM] Fwd: Index on table when using DESC clause

2005-05-23 Thread Yves Vindevogel
I tried that, but create index ixTest on table1 (pages desc, documentname) gives me a syntax error On 23 May 2005, at 20:03, Steinar H. Gunderson wrote: On Mon, May 23, 2005 at 07:41:19PM +0200, Yves Vindevogel wrote: However, when I query my db using for instance order by pages,

Re: [PERFORM] Fwd: Index on table when using DESC clause

2005-05-23 Thread Oleg Bartunov
You didn't say what version of PostgreSQL you're trying. I recall old version doesn't used index for backward pagination. Oleg On Mon, 23 May 2005, Yves Vindevogel wrote: I tried that, but create index ixTest on table1 (pages desc, documentname) gives me a syntax error On 23 May 2005, at

Re: [PERFORM] Fwd: Index on table when using DESC clause

2005-05-23 Thread Andrew Lazarus
As far as I know, to use a straight index Postgres requires either ORDER BY pages, description -- or -- ORDER BY pages DESC, description DESC. If you want the results by pages DESC, description ASC, then you have to make an index on an expression or define your own operator or something