Re: Use simplehash.h instead of dynahash in SMgr - Mailing list pgsql-hackers

From David Rowley
Subject Re: Use simplehash.h instead of dynahash in SMgr
Date
Msg-id CAApHDvoV9AfZCYw1dZQVUL-FNp8n8cxnn9gtdbn74S4V80ygLQ@mail.gmail.com
Whole thread Raw
In response to Re: Use simplehash.h instead of dynahash in SMgr  (Yura Sokolov <y.sokolov@postgrespro.ru>)
Responses Re: Use simplehash.h instead of dynahash in SMgr  (David Rowley <dgrowleyml@gmail.com>)
List pgsql-hackers
On Thu, 29 Apr 2021 at 12:30, Yura Sokolov <y.sokolov@postgrespro.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



pgsql-hackers by date:

Previous
From: Justin Pryzby
Date:
Subject: Re: Small issues with CREATE TABLE COMPRESSION
Next
From: Peter Geoghegan
Date:
Subject: Re: [BUG]"FailedAssertion" reported in lazy_scan_heap() when running logical replication