Re: BUG #14635: Query is executed slower on hot standby slave database then on master database

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Vitaliy Gomenyuk <vgomenyuk(at)callfire(dot)com>
Cc: Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>, Aleksandr Saraseka <asaraseka(at)callfire(dot)com>
Subject: Re: BUG #14635: Query is executed slower on hot standby slave database then on master database
Date: 2017-05-03 14:05:59
Message-ID: 25801.1493820359@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Vitaliy Gomenyuk <vgomenyuk(at)callfire(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message ehoffman 2017-05-03 15:32:41 BUG #14640: text mode installation still send X11 requests
Previous Message Ashutosh Sharma 2017-05-03 12:44:02 Re: [HACKERS] Re: BUG #14634: On Windows pg_basebackup should write tar to stdout in binary mode