Re: Slow planning time for simple query

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Maksim Milyutin <milyutinma(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Slow planning time for simple query
Date: 2018-06-17 10:39:30
Message-ID: 87po0pr97m.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

>>>>> "Amit" == Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> writes:

>> Presumably the problem is that the standby isn't authorized to change
>> the btree index's "entry is dead" bits,

Amit> I don't see anything like that in the code. We use _bt_killitems
Amit> to mark the items as dead and neither that function or any of its
Amit> caller has any such assumption.

See index_fetch_heap:

/*
* If we scanned a whole HOT chain and found only dead tuples, tell index
* AM to kill its entry for that TID (this will take effect in the next
* amgettuple call, in index_getnext_tid). We do not do this when in
* recovery because it may violate MVCC to do so. See comments in
* RelationGetIndexScan().
*/
if (!scan->xactStartedInRecovery)
scan->kill_prior_tuple = all_dead;

(this is the only place where kill_prior_tuple can be set to true)

--
Andrew (irc:RhodiumToad)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2018-06-17 14:46:08 Re: Slow planning time for simple query
Previous Message Benjie Gillam 2018-06-17 09:09:40 Re: Detecting functions installed by an extension

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2018-06-17 12:15:20 Re: pg_config.h.win32 missing a set of flags from pg_config.h.in added in v11 development
Previous Message Nikhil Sontakke 2018-06-17 08:34:26 Re: pgsql: Store 2PC GID in commit/abort WAL recs for logical decoding