Re: Small improvement to compactify_tuples
Andres Freund <andres@anarazel.de>
From: Andres Freund <andres@anarazel.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Claudio Freire <klaussfreire@gmail.com>, Robert Haas <robertmhaas@gmail.com>, Юрий Соколов <funny.falcon@gmail.com>, Sokolov Yura <funny.falcon@postgrespro.ru>, Alvaro Herrera <alvherre@2ndquadrant.com>, Heikki Linnakangas <hlinnaka@iki.fi>, PostgreSQL-Dev <pgsql-hackers@postgresql.org>
Date: 2017-11-08T20:59:43Z
Lists: pgsql-hackers
On 2017-11-08 12:02:40 -0500, Tom Lane wrote: > BTW, it strikes me that in considering the rebuild-the-page approach, > we should not have blinders on and just measure the speed of > PageRepairFragmentation. Rather, we should take a look at what happens > subsequently given a physically-ordered set of tuples. I can recall > Andres or someone moaning awhile ago about lack of locality of access in > index page searches --- maybe applying that approach while vacuuming > indexes will help? I complained about multiple related things, I'm not exactly sure what exactly you're referring to here: - The fact that HeapTupleHeaderData's are commonly iterated over in reverse order is bad for performance. For shared buffers resident workloads involving seqscans that yields 15-25% slowdowns for me. It's trivial to fix that by just changing iteration order, but that obviously changes results. But we could reorder the page during heap pruning. But that's fairly independent of indexes, so I'm not sure whether that's what you're referring. - The layout of items in index pages is suboptimal. We regularly do binary searches over the the linearly ordered items, which is cache inefficient. So instead we should sort items as [1/2, 1/4, 3/4, ...] elements, which will access items in a close-ish to linear manner. But that's fairly independent of pruning, so I'm not sure whether that's what you're referring to, either. Greetings, Andres Freund
Commits
-
Avoid looping through line pointers twice in PageRepairFragmentation().
- a9169f0200fc 11.0 landed
-
Reduce pinning and buffer content locking for btree scans.
- 2ed5b87f96d4 9.5.0 cited
-
Speed up in-memory tuplesorting.
- 337b6f5ecf05 9.2.0 cited