Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ckl7y-0006cR-EJ for pgsql-performance@arkaria.postgresql.org; Mon, 06 Mar 2017 05:24:10 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1ckl7x-0001h5-PI for pgsql-performance@arkaria.postgresql.org; Mon, 06 Mar 2017 05:24:09 +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_2) (envelope-from ) id 1ckl7w-0001gb-UY for pgsql-performance@postgresql.org; Mon, 06 Mar 2017 05:24:09 +0000 Received: from mail-it0-x235.google.com ([2607:f8b0:4001:c0b::235]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1ckl7t-0007h9-JP for pgsql-performance@postgresql.org; Mon, 06 Mar 2017 05:24:07 +0000 Received: by mail-it0-x235.google.com with SMTP id w124so272285itb.0 for ; Sun, 05 Mar 2017 21:24:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=RqrQL4N/qQ01g/nmv/f5h59jeKM0SnxyOlZ17IfgVZQ=; b=hO/2lVsPND0co4KD4+CBs9bhlv2aSmS9+njf1Fe15dHutmZWkG1OTFovUXCqbObm3K PJwPLeY8ctAMzpCfs+uYgYgI+qU3Z9jKN56PcTxB7f1yW6/WBUtJdp9FVU8FgHOpR8Uj b+HACScC1eg0EKmEBRJvAAtdi1Hkw1WvvKQj50Dbn48+as1249O/KxNbIF4NtvhoXvRR bZmRxUkAFiFa0gxvztS9At4vujkG1TbWds7Iw9xcYhkTcpe3m5UQ7AOHkveAMpidptwT zIVUlbiMTLmSo5lbpyclhB2i62M6m8CBdI3nL+fmBzcMXquwKmgoJumfW4X3NdvbSmRg L7gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=RqrQL4N/qQ01g/nmv/f5h59jeKM0SnxyOlZ17IfgVZQ=; b=DPgELj02qcXtkTtSnHymZAC5s5yMaN+3NyIGYqygzF5OZHssxMVT6sqPKOjKwmR7UE btOjhHGjGDXlzEktMCpn0jbrRSANfhpZ+qC5AHSOoEaOHyFhDfyvZ/kcWtTj9HLvD6A0 tjGsuuf18kZL04+KVHOvVEBJb2HUSZ1wCkHYekqHkVumXza2IDGz6wlP/YV14yr2JCax ungvQ7ZirWjB/tAlrM0u+v7VCHIVCXAion4ItLBikdrHphk25pSuTKqO9SRoM38v5xRu 4ajL6jqkYkX218e7lxTOhrmVmSgnP+G1yzeudu222ELBGtYpXEh0fHa7ySIzUeNVZEz3 SUKA== X-Gm-Message-State: AMke39nKHjN25R1ABqy+y/mO17owCq2VQRLM8YNr7xmCZjAH6HMNPp7DoePkNadJgnOZsw== X-Received: by 10.36.69.217 with SMTP id c86mr13091939itd.40.1488777843846; Sun, 05 Mar 2017 21:24:03 -0800 (PST) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id i195sm4314293ita.17.2017.03.05.21.24.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Mar 2017 21:24:03 -0800 (PST) Received: by pryzbyj (Postfix, from userid 1000) id 42DCC801B8F; Sun, 5 Mar 2017 23:24:02 -0600 (CST) Date: Sun, 5 Mar 2017 23:24:02 -0600 From: Justin Pryzby To: Dinesh Chandra 12108 Cc: Nur Agus , Jeff Janes , pgsql-performance@postgresql.org Subject: Re: Performance issue in PostgreSQL server... Message-ID: <20170306052402.GC16088@telsasoft.com> References: <0796d1d53d3e4aa692cfdc329f86b399@cyient.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -2.6 (--) 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 On Sun, Mar 05, 2017 at 08:23:08PM -0800, Jeff Janes wrote: > On Fri, Mar 3, 2017 at 4:44 AM, Dinesh Chandra 12108 wrote: > > The below is the output for psql=> EXPLAIN ANALYZE SELECT DISTINCT > > feature_id FROM evidence.point p INNER JOIN evidence.observation_evidence > > oe ON p.feature_id = oe.evd_feature_id WHERE p.domain_class_id IN (11) AND > > (p.modification_time > '2015-05-10 00:06:56.056 IST' OR > > oe.modification_time > '2015-05-10 00:06:56.056 IST') ORDER BY feature_id > ... > > > -> Index Scan using point_domain_class_id_index on point p (cost=0.00..1483472.70 rows=1454751 width=16) (actual time=27.265..142101.1 59 rows=1607491 loops=1) > > Index Cond: (domain_class_id = 11) > > Why wouldn't this be using a bitmap scan rather than a regular index scan? > It seems like it should prefer the bitmap scan, unless the table is well > clustered on domain_class_id. In which case, why isn't it just faster? Could you send: SELECT * FROM pg_stats WHERE tablename='point' AND attname='domain_class_id' ; .. or if that's too verbose or you don't want to share the histogram or MCV list: SELECT correlation FROM pg_stats WHERE tablename='point' AND attname='domain_class_id' ; Justin -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance