Re: Speed up pg_checksums in cases where checksum already set

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: Greg Sabino Mullane <htamfids(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Speed up pg_checksums in cases where checksum already set
Date: 2021-05-27 01:26:23
Message-ID: CAOBaU_bT0_U8j_dim5NtOPSmMDRS0jvxvt8PMjA_DcCZLK8BhQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, May 27, 2021 at 5:24 AM Greg Sabino Mullane <htamfids(at)gmail(dot)com> wrote:
>
> The attached patch makes an optimization to pg_checksums which prevents rewriting the block if the checksum is already what we expect. This can lead to much faster runs in cases where it is already set (e.g. enabled -> disabled -> enable, external helper process, interrupted runs, future parallel processes). There is also an effort to not sync the data directory if no changes were written. Finally, added a bit more output on how many files were actually changed, e.g.:

I don't know how often this will actually help as probably people
aren't toggling the checksum state that often, but it seems like a
good idea overall. The patch looks sensible to me.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message houzj.fnst@fujitsu.com 2021-05-27 01:42:07 RE: Parallel Inserts in CREATE TABLE AS
Previous Message tanghy.fnst@fujitsu.com 2021-05-27 01:20:25 RE: [HACKERS] logical decoding of two-phase transactions