From: Tom Lane <tgl@sss.pgh.pa.us>
To: Vitaliy Gomenyuk <vgomenyuk@callfire.com>
Cc: Haribabu Kommi <kommi.haribabu@gmail.com>
Cc: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Cc: Aleksandr Saraseka <asaraseka@callfire.com>
Subject: Re: BUG #14635: Query is executed slower on hot standby slave database then on master database
Date: Wed, 03 May 2017 10:05:59 -0400
Message-ID: <25801.1493820359@sss.pgh.pa.us> (raw)
In-Reply-To: <CAB3vJC=jtteQppCcRqvPW1DhthO3sWQO4GKpr7FYjk2-Y_SL5A@mail.gmail.com>
References: <20170428133818.24368.33533@wrigleys.postgresql.org>
<CAJrrPGcjNZO5UkexVfjF_CCBVrPtoY-iVvEYhP1n97z0ARWLoQ@mail.gmail.com>
<CAB3vJC=jtteQppCcRqvPW1DhthO3sWQO4GKpr7FYjk2-Y_SL5A@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
Vitaliy Gomenyuk <vgomenyuk@callfire.com> 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_StampToSend_Deleted" (cost=0.00..3556.90 rows=80249 width=0) (actual time=139.761..139.761 rows=9158 loops=1)
> Index Cond: ((om."Status" = 0) AND (om."Deleted" = false))
> Buffers: shared hit=70252
> There is an execution plan from slave:
> -> Bitmap Index Scan on "OutgoingMessages_Status_StampToSend_Deleted" (cost=0.00..3556.90 rows=80249 width=0) (actual time=1470.853..1470.853 rows=8671249 loops=1)
> Index Cond: ((om."Status" = 0) AND (om."Deleted" = false))
> Buffers: shared hit=70252
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
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, vgomenyuk@callfire.com, kommi.haribabu@gmail.com, asaraseka@callfire.com
Subject: Re: BUG #14635: Query is executed slower on hot standby slave database then on master database
In-Reply-To: <25801.1493820359@sss.pgh.pa.us>
References: <20170428133818.24368.33533@wrigleys.postgresql.org> <CAJrrPGcjNZO5UkexVfjF_CCBVrPtoY-iVvEYhP1n97z0ARWLoQ@mail.gmail.com> <CAB3vJC=jtteQppCcRqvPW1DhthO3sWQO4GKpr7FYjk2-Y_SL5A@mail.gmail.com> <25801.1493820359@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