Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d5uux-0007CC-81 for pgsql-bugs@arkaria.postgresql.org; Wed, 03 May 2017 14:06:11 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1d5uuv-0007dk-UL for pgsql-bugs@arkaria.postgresql.org; Wed, 03 May 2017 14:06:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1d5uuv-0007da-GZ for pgsql-bugs@postgresql.org; Wed, 03 May 2017 14:06:09 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1d5uuo-0000hI-8O for pgsql-bugs@postgresql.org; Wed, 03 May 2017 14:06:09 +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 v43E5xf4025802; Wed, 3 May 2017 10:05:59 -0400 From: Tom Lane To: Vitaliy Gomenyuk cc: Haribabu Kommi , "pgsql-bugs@postgresql.org" , Aleksandr Saraseka Subject: Re: BUG #14635: Query is executed slower on hot standby slave database then on master database In-reply-to: References: <20170428133818.24368.33533@wrigleys.postgresql.org> Comments: In-reply-to Vitaliy Gomenyuk message dated "Wed, 03 May 2017 13:04:06 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <25800.1493820359.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 03 May 2017 10:05:59 -0400 Message-ID: <25801.1493820359@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-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Vitaliy Gomenyuk writes: > [ same query slower on slave ] Hmm, the discrepancy is evidently in the larger bitmap index scan: > There is an execution plan from master: > -> Bitmap Index Scan on "OutgoingMessages_Status_St= ampToSend_Deleted" (cost=3D0.00..3556.90 rows=3D80249 width=3D0) (actual t= ime=3D139.761..139.761 rows=3D9158 loops=3D1) > Index Cond: ((om."Status" =3D 0) AND (om."Dele= ted" =3D false)) > Buffers: shared hit=3D70252 > There is an execution plan from slave: > -> Bitmap Index Scan on "OutgoingMessages_Status_St= ampToSend_Deleted" (cost=3D0.00..3556.90 rows=3D80249 width=3D0) (actual t= ime=3D1470.853..1470.853 rows=3D8671249 loops=3D1) > Index Cond: ((om."Status" =3D 0) AND (om."Dele= ted" =3D false)) > Buffers: shared hit=3D70252 The contents of the indexes should be the same, so why is the slave returning so many more rows? It has to be because the index entries are not marked as killed (known-dead-to-everybody), or not being treated as killed, in the slave. I vaguely recall that there's a difference in the rules for index entry visibility on slaves, but it's not clear to me why that should be. regards, tom lane --=20 Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs