Re: [PERFORM] Why don't use index on x when ORDER BY x, y?

2014-11-24 Thread Tom Lane
Vlad Arkhipov writes: > I wonder why Postgres does not use index in the query below? Because it's useless: you'd still have to do a sort, and an indexscan is going to be a slower source of data for the sort than a seqscan. There's been some experimentation of late with a "partial sort" capabilit

Re: [PERFORM] Why don't use index on x when ORDER BY x, y?

2014-11-24 Thread Robert Klemme
On Mon, Nov 24, 2014 at 12:02 PM, Vlad Arkhipov wrote: > Hello, > > I wonder why Postgres does not use index in the query below? It is a quite > common use-case when you want to sort records by an arbitrary set of > columns but do not want to create a lot of compound indexes for all possible > com

[PERFORM] Why don't use index on x when ORDER BY x, y?

2014-11-24 Thread Vlad Arkhipov
Hello, I wonder why Postgres does not use index in the query below? It is a quite common use-case when you want to sort records by an arbitrary set of columns but do not want to create a lot of compound indexes for all possible combinations of them. It seems that if, for instance, your query