pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Maksim Milyutin <milyutinma@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-general@lists.postgresql.org
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Slow planning time for simple query
Date: Thu, 14 Jun 2018 02:04:26 +0300
Message-ID: <4d61f569-c781-9066-c6b8-471e963d7759@gmail.com> (raw)
In-Reply-To: <7a5653e4-5a94-18d3-17e4-7e11ed2c9919@gmail.com>
References: <36adf760-680b-7a4a-e019-64f4eaaf6ff7@gmail.com>
	<9661.1528573749@sss.pgh.pa.us>
	<7a5653e4-5a94-18d3-17e4-7e11ed2c9919@gmail.com>

13.06.2018 12:40, Maksim Milyutin wrote:

> On 09.06.2018 22:49, Tom Lane wrote:
>
>> Maksim Milyutin<milyutinma@gmail.com>  writes:
>>> On hot standby I faced with the similar problem.
>>> ...
>>> is planned 4.940 ms on master and *254.741* ms on standby.
>> (I wonder though why, if you executed the same query on the master,
>> its setting of the index-entry-is-dead bits didn't propagate to the
>> standby.)
>
> I have verified the number dead item pointers (through pageinspect 
> extension) in the first leaf page of index participating in query 
> ('main.message_instance_pkey') on master and slave nodes and have 
> noticed a big difference.
>
> SELECT * FROM monitoring.bt_page_stats('main.message_instance_pkey', 
> 3705);
>
> On master:
>
>  blkno | type | live_items | dead_items | avg_item_size | page_size | 
> free_size | btpo_prev | btpo_next | btpo | btpo_flags
> -------+------+------------+------------+---------------+-----------+-----------+-----------+-----------+------+------------
>   3705 | l    |          1 |         58 |            24 |      8192 
> |      6496 |         0 |      3719 |    0 | 65
>
> On standby:
>
>  blkno | type | live_items | dead_items | avg_item_size | page_size | 
> free_size | btpo_prev | btpo_next | btpo | btpo_flags
> -------+------+------------+------------+---------------+-----------+-----------+-----------+-----------+------+------------
>   3705 | l    |         59 |          0 |            24 |      8192 
> |      6496 |         0 |      3719 |    0 |          1
>
>

In this point I want to highlight the issue that the changes in 
*lp_flags* bits (namely, set items as dead) for index item pointers 
doesn't propagate from master to replica in my case. As a consequence, 
on standby I have live index items most of which on master are marked as 
dead. And my queries on planning stage are forced to descent to heap 
pages under *get_actual_variable_range* execution that considerately 
slows down planning.

Is it bug or restriction of implementation or misconfiguration of 
WAL/replication?

-- 
Regards,
Maksim Milyutin

view thread (22+ messages)  latest in thread

Message-ID: <4d61f569-c781-9066-c6b8-471e963d7759@gmail.com>
Permalink:  ../4d61f569-c781-9066-c6b8-471e963d7759@gmail.com/
Also on:    postgresql.org/message-id/4d61f569-c781-9066-c6b8-471e963d7759@gmail.com

 · 

reply

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-general@postgresql.org
  Cc: milyutinma@gmail.com, tgl@sss.pgh.pa.us, pgsql-hackers@lists.postgresql.org
  Subject: Re: Slow planning time for simple query
  In-Reply-To: <4d61f569-c781-9066-c6b8-471e963d7759@gmail.com>
  References: <36adf760-680b-7a4a-e019-64f4eaaf6ff7@gmail.com> <9661.1528573749@sss.pgh.pa.us> <7a5653e4-5a94-18d3-17e4-7e11ed2c9919@gmail.com> <4d61f569-c781-9066-c6b8-471e963d7759@gmail.com>

* 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