Re: Small improvement to compactify_tuples

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Claudio Freire <klaussfreire(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Юрий Соколов <funny(dot)falcon(at)gmail(dot)com>, Sokolov Yura <funny(dot)falcon(at)postgrespro(dot)ru>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, PostgreSQL-Dev <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Small improvement to compactify_tuples
Date: 2017-11-08 20:59:43
Message-ID: 20171108205943.tps27i2tujsstrg7@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-11-08 21:05:27 Re: Simplify ACL handling for large objects and removal of superuser() checks
Previous Message jotpe 2017-11-08 20:49:15 [PATCH] fix wrong create table statement in documentation