Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Xsvjm-0002ut-2y for pgsql-performance@arkaria.postgresql.org; Mon, 24 Nov 2014 15:39:38 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Xsvjl-0002nX-Cg for pgsql-performance@arkaria.postgresql.org; Mon, 24 Nov 2014 15:39:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Xsvjk-0002nG-8K for pgsql-performance@postgresql.org; Mon, 24 Nov 2014 15:39:36 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Xsvjb-0005bB-K7 for pgsql-performance@postgresql.org; Mon, 24 Nov 2014 15:39:35 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id sAOFckWp023349; Mon, 24 Nov 2014 10:38:47 -0500 From: Tom Lane To: Vlad Arkhipov cc: pgsql-performance Subject: Re: Why don't use index on x when ORDER BY x, y? In-reply-to: <5473103A.5040004@dc.baikal.ru> References: <5473103A.5040004@dc.baikal.ru> Comments: In-reply-to Vlad Arkhipov message dated "Mon, 24 Nov 2014 19:02:18 +0800" Date: Mon, 24 Nov 2014 10:38:46 -0500 Message-ID: <23348.1416843526@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org 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" 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