Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aRMSe-0008FU-93 for pgsql-performance@arkaria.postgresql.org; Thu, 04 Feb 2016 16:08:48 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aRMSc-0006ca-Ip for pgsql-performance@arkaria.postgresql.org; Thu, 04 Feb 2016 16:08:46 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aRMSb-0006cG-PO for pgsql-performance@postgresql.org; Thu, 04 Feb 2016 16:08:45 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aRMSZ-000628-6c for pgsql-performance@postgresql.org; Thu, 04 Feb 2016 16:08:44 +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 u14G8fUL017856; Thu, 4 Feb 2016 11:08:42 -0500 From: Tom Lane To: Jordi cc: pgsql-performance@postgresql.org Subject: Re: Bitmap and-ing between btree and gin? In-reply-to: <56B332B6.1040109@promani.be> References: <56B332B6.1040109@promani.be> Comments: In-reply-to Jordi message dated "Thu, 04 Feb 2016 12:15:02 +0100" Date: Thu, 04 Feb 2016 11:08:41 -0500 Message-ID: <17855.1454602121@sss.pgh.pa.us> X-Pg-Spam-Score: -2.4 (--) 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 Jordi writes: > I've been trying to get a query use indexes and it has raised a doubt > whether pgsql supports bitmap and-ing between a multi-column btree index > and a gin index. Sure. But such a plan would give an unordered result, meaning that we'd have to process the whole table before doing the ORDER BY/LIMIT. The planner evidently thinks that it's better to try to process the rows in ID order so it can stop as soon as it's got 100. If it's wrong about that, that's likely because it's got a bad estimate of the selectivity of the other WHERE conditions. You might see if you can improve the statistics for the search_vector column. 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