]> granicus.if.org Git - postgresql/commit
Checkpoint sorting and balancing.
authorAndres Freund <andres@anarazel.de>
Fri, 19 Feb 2016 20:17:51 +0000 (12:17 -0800)
committerAndres Freund <andres@anarazel.de>
Fri, 11 Mar 2016 01:05:09 +0000 (17:05 -0800)
commit9cd00c457e6a1ebb984167ac556a9961812a683c
tree1d2857a1ef71d9031651a665b2c754a89d813718
parent428b1d6b29ca599c5700d4bc4f4ce4c5880369bf
Checkpoint sorting and balancing.

Up to now checkpoints were written in the order they're in the
BufferDescriptors. That's nearly random in a lot of cases, which
performs badly on rotating media, but even on SSDs it causes slowdowns.

To avoid that, sort checkpoints before writing them out. We currently
sort by tablespace, relfilenode, fork and block number.

One of the major reasons that previously wasn't done, was fear of
imbalance between tablespaces. To address that balance writes between
tablespaces.

The other prime concern was that the relatively large allocation to sort
the buffers in might fail, preventing checkpoints from happening. Thus
pre-allocate the required memory in shared memory, at server startup.

This particularly makes it more efficient to have checkpoint flushing
enabled, because that'll often result in a lot of writes that can be
coalesced into one flush.

Discussion: alpine.DEB.2.10.1506011320000.28433@sto
Author: Fabien Coelho and Andres Freund
src/backend/storage/buffer/README
src/backend/storage/buffer/buf_init.c
src/backend/storage/buffer/bufmgr.c
src/include/storage/buf_internals.h
src/tools/pgindent/typedefs.list