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

From: Vitaliy Gomenyuk <vgomenyuk(at)callfire(dot)com>
To: Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>
Cc: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "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-29 11:31:28
Message-ID: CAB3vJCnb49OBV9xT6KdfCXFLg_D2eNxKy97A=g4Lrp=g6aeofw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

That make sense.
Sadly, that there is no other way, except vacuum, how to improve the
situation.
Thank you for all your answers.

On Fri, May 26, 2017 at 8:12 PM, Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>
wrote:

>
>
> On Fri, May 26, 2017 at 9:42 PM, Vitaliy Gomenyuk <vgomenyuk(at)callfire(dot)com>
> wrote:
>
>> Hello,
>>
>> So we have two reasons of current problem:
>>
>> 1. Changes to hint bits are not WAL logged => can be fixed by upgrading
>> PostgreSQL at least to 9.4 version and turning on parameter "wal_log_hints";
>>
>> 2. Slave DB does not use the index hint bits while it is in hot standby
>> mode => how this can be fixed?
>>
>
> The main reason for slave DB not use the index hint bits because of
> difference
> in between xmin value of both master and standby, This is required for
> proper
> MVCC behavior for the queries that are running on the standby.
>
> Following is the comment from the code that explains more.
>
> /*
> * During recovery we ignore killed tuples and don't bother to kill them
> * either. We do this because the xmin on the primary node could easily be
> * later than the xmin on the standby node, so that what the primary
> * thinks is killed is supposed to be visible on standby. So for correct
> * MVCC for queries during recovery we must ignore these hints and check
> * all tuples. Do *not* set ignore_killed_tuples to true when running in a
> * transaction that was started during recovery. xactStartedInRecovery
> * should not be altered by index AMs.
> */
>
> Even if the hint bits are WAL logged, it doesn't solve the problem of
> multiple
> rows selection in standby. I feel the only way to reduce the number of
> dead tuples
> visibility in standby, do a frequent VACUUM or Increase the AUTOVACUUM
> interval or changing the default values of AUTOVACUUM parameters of the
> tables that are frequently updated/deleted as these operations generates
> dead
> tuples.
>
> Regards,
> Hari Babu
> Fujitsu Australia
>

--

Best regards,
*Vitaliy Gomenyuk*

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message fabriciorsf 2017-05-29 13:11:01 BUG #14674: Error on install portgresql
Previous Message eric.quinton 2017-05-29 09:35:05 BUG #14672: with UTF-8, indexes are not used with order by on multiple tables