Re: [HACKERS] Checksums by default? - Mailing list pgsql-hackers

From Ants Aasma
Subject Re: [HACKERS] Checksums by default?
Date
Msg-id CA+CSw_v4KTXZTmN=LSVMZdXA0gqobXjokgMVj3ougXpqkFzC5Q@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] Checksums by default?  (Fujii Masao <masao.fujii@gmail.com>)
Responses Re: [HACKERS] Checksums by default?  (Michael Banck <michael.banck@credativ.de>)
Re: [HACKERS] Checksums by default?  (Bruce Momjian <bruce@momjian.us>)
List pgsql-hackers
On Sat, Jan 21, 2017 at 6:41 PM, Andreas Karlsson <andreas@proxel.se> wrote:
> On 01/21/2017 04:48 PM, Stephen Frost wrote:
>>
>> * Fujii Masao (masao.fujii@gmail.com) wrote:
>>>
>>> If the performance overhead by the checksums is really negligible,
>>> we may be able to get rid of wal_log_hints parameter, as well.
>>
>>
>> Prior benchmarks showed it to be on the order of a few percent, as I
>> recall, so I'm not sure that we can say it's negligible (and that's not
>> why Magnus was proposing changing the default).
>
>
> It might be worth looking into using the CRC CPU instruction to reduce this
> overhead, like we do for the WAL checksums. Since that is a different
> algorithm it would be a compatibility break and we would need to support the
> old algorithm for upgraded clusters..

We looked at that when picking the algorithm. At that point it seemed
that CRC CPU instructions were not universal enough to rely on them.
The algorithm we ended up on was designed to be fast on SIMD hardware.
Unfortunately on x86-64 that required SSE4.1 integer instructions, so
with default compiles there is a lot of performance left on table. A
low hanging fruit would be to do CPU detection like the CRC case and
enable a SSE4.1 optimized variant when those instructions are
available. IIRC it was actually a lot faster than the naive hardware
CRC that is used for WAL and about on par with interleaved CRC.

That said the actual checksum calculation was not a big issue for
performance. The only way to make it really matter was with a larger
than shared buffers smaller than RAM workload with tiny per page
execution overhead. My test case was SELECT COUNT(*) on wide rows with
a small fill factor. Having to WAL log hint bits is the major issue.

Regards,
Ants Aasma



pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: [HACKERS] Checksums by default?
Next
From: Ants Aasma
Date:
Subject: Re: [HACKERS] Checksums by default?