pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Vlad Arkhipov <arhipov@dc.baikal.ru>
Cc: pgsql-performance <pgsql-performance@postgresql.org>
Subject: Re: Why don't use index on x when ORDER BY x, y?
Date: Mon, 24 Nov 2014 10:38:46 -0500
Message-ID: <23348.1416843526@sss.pgh.pa.us> (raw)
In-Reply-To: <5473103A.5040004@dc.baikal.ru>
References: <5473103A.5040004@dc.baikal.ru>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

Vlad Arkhipov <arhipov@dc.baikal.ru> 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" capability
that could take advantage of partially-ordered input, which might make
this kind of thing interesting after all.  But it's not committed and
might never be: it's far from clear that it'd be a win in many cases.

			regards, tom lane


-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance



view thread (3+ messages)

Message-ID: <23348.1416843526@sss.pgh.pa.us>
Permalink:  ../23348.1416843526@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/23348.1416843526@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, arhipov@dc.baikal.ru
  Subject: Re: Why don't use index on x when ORDER BY x, y?
  In-Reply-To: <23348.1416843526@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox