Re: Use simplehash.h instead of dynahash in SMgr

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Yura Sokolov <y(dot)sokolov(at)postgrespro(dot)ru>
Cc: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Use simplehash.h instead of dynahash in SMgr
Date: 2021-04-29 04:19:03
Message-ID: CAApHDvoV9AfZCYw1dZQVUL-FNp8n8cxnn9gtdbn74S4V80ygLQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 29 Apr 2021 at 12:30, Yura Sokolov <y(dot)sokolov(at)postgrespro(dot)ru> wrote:
>
> David Rowley писал 2021-04-29 02:51:
> > Another line of thought for making it go faster would be to do
> > something like get rid of the hash status field from SMgrEntry. That
> > could be either coded into a single bit we'd borrow from the hash
> > value, or it could be coded into the least significant bit of the data
> > field. A pointer to palloc'd memory should always be MAXALIGNed,
> > which means at least the lower two bits are always zero. We'd just
> > need to make sure and do something like "data & ~((uintptr_t) 3)" to
> > trim off the hash status bits before dereferencing the pointer. That
> > would make the SMgrEntry 12 bytes on a 64-bit machine. However, it
> > would also mean that some entries would span 2 cache lines, which
> > might affect performance a bit.
>
> Then data pointer will be itself unaligned to 8 bytes. While x86 is
> mostly indifferent to this, doubtfully this memory economy will pay
> off.

Actually, I didn't think very hard about that. The struct would still
be 16 bytes and just have padding so the data pointer was aligned to 8
bytes (assuming a 64-bit machine).

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2021-04-29 04:21:43 Re: [BUG]"FailedAssertion" reported in lazy_scan_heap() when running logical replication
Previous Message Justin Pryzby 2021-04-29 04:01:33 Re: Small issues with CREATE TABLE COMPRESSION