From: | Maksim Milyutin <milyutinma(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-general(at)lists(dot)postgresql(dot)org, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: Slow planning time for simple query |
Date: | 2018-06-13 09:40:54 |
Message-ID: | 7a5653e4-5a94-18d3-17e4-7e11ed2c9919@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
On 09.06.2018 22:49, Tom Lane wrote:
> Maksim Milyutin <milyutinma(at)gmail(dot)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
The vacuum routine improves the situation.
Сan there be something that I have incorrectly configured WAL logging or
replication?
> I wonder if we should extend the "SnapshotNonVacuumable" logic introduced
> in commit 3ca930fc3 so that in hot standby, *all* index entries are deemed
> non vacuumable. This would essentially get rid of long standby planning
> times in this sort of scenario by instead accepting worse (possibly much
> worse) planner range estimates. I'm unsure if that's a good tradeoff or
> not.
I applied the patch introduced in this commit to test standby (not
master; I don't know if this is correct) and haven't noticed any
differences.
--
Regards,
Maksim Milyutin
From | Date | Subject | |
---|---|---|---|
Next Message | Vadim Nevorotin | 2018-06-13 09:55:27 | First query on each connection is too slow |
Previous Message | Laurenz Albe | 2018-06-13 04:29:51 | Re: How can I retrieve double or int data type for libpq |
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Langote | 2018-06-13 09:42:54 | Re: BUG #15212: Default values in partition tables don't work as expected and allow NOT NULL violation |
Previous Message | Masahiko Sawada | 2018-06-13 08:58:19 | Index maintenance function for BRIN doesn't check RecoveryInProgress() |