Re: ERROR: found unexpected null value in index
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Geoghegan <pg@bowt.ie>
Cc: Andres Freund <andres@anarazel.de>,
Manuel Rigger <rigger.manuel@gmail.com>,
PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Date: 2019-07-11T21:20:07Z
Lists: pgsql-bugs
Attachments
- fix-get_actual_variable_range-for-HOT-chains.patch (text/x-diff) patch
I wrote: > Index-only scans already have the LP_DEAD fast path (don't return value) > and the all_visible fast path (always return value), and otherwise they > do a heap visit. If we can use a custom visibility test in the heap > visit and not muck up the opportunity to set LP_DEAD when relevant, then > it seems like using the IOS code path will do exactly what we want. > Otherwise some finagling might be necessary. But it still might be > cleaner than directly looking at HOT-update status. > I'll take a look at that tomorrow if nobody beats me to it. As far as I can tell, no special finagling is needed: if we just use the regular index-only-scan logic then this all works the way we want, and it's actually better than before because we get to skip heap visits altogether when dealing with unchanging data. Attached is a patch against HEAD that seems to do all the right things. I'm a little dissatisfied with the fact that I had to duplicate the all-visible checking logic out of nodeIndexonlyscan.c. Maybe we should think about refactoring to avoid multiple copies of that? But that's probably a task for a separate patch, if it's practical at all. regards, tom lane
Commits
-
Fix get_actual_variable_range() to cope with broken HOT chains.
- d3751adcf14d 13.0 landed
- cee976c4e8c4 12.0 landed
- 5c1b7edc23a0 11.5 landed
-
Improve performance of get_actual_variable_range with recently-dead tuples.
- 3ca930fc39cc 11.0 cited