Re: [PoC] Improve dead tuple storage for lazy vacuum
Masahiko Sawada <sawada.mshk@gmail.com>
On Sat, Jul 10, 2021 at 2:17 AM Andres Freund <andres@anarazel.de> wrote: > > Hi, > > On 2021-07-07 20:46:38 +0900, Masahiko Sawada wrote: > > Currently, the TIDs of dead tuples are stored in an array that is > > collectively allocated at the start of lazy vacuum and TID lookup uses > > bsearch(). There are the following challenges and limitations: > > > So I prototyped a new data structure dedicated to storing dead tuples > > during lazy vacuum while borrowing the idea from Roaring Bitmap[2]. > > The authors provide an implementation of Roaring Bitmap[3] (Apache > > 2.0 license). But I've implemented this idea from scratch because we > > need to integrate it with Dynamic Shared Memory/Area to support > > parallel vacuum and need to support ItemPointerData, 6-bytes integer > > in total, whereas the implementation supports only 4-bytes integers. > > Also, when it comes to vacuum, we neither need to compute the > > intersection, the union, nor the difference between sets, but need > > only an existence check. > > > > The data structure is somewhat similar to TIDBitmap. It consists of > > the hash table and the container area; the hash table has entries per > > block and each block entry allocates its memory space, called a > > container, in the container area to store its offset numbers. The > > container area is actually an array of bytes and can be enlarged as > > needed. In the container area, the data representation of offset > > numbers varies depending on their cardinality. It has three container > > types: array, bitmap, and run. > > How are you thinking of implementing iteration efficiently for rtbm? The > second heap pass needs that obviously... I think the only option would > be to qsort the whole thing? Yes, I'm thinking that the iteration of rtbm is somewhat similar to tbm. That is, we iterate and collect hash table entries and do qsort hash entries by the block number. Then fetch the entry along with its container one by one in order of the block number. Regards, -- Masahiko Sawada EDB: https://www.enterprisedb.com/
Commits
-
radixtree: Fix SIGSEGV at update of embeddable value to non-embeddable.
- bb7f195ff788 17.0 landed
-
Get rid of anonymous struct
- bf183f168c44 17.0 landed
-
Teach radix tree to embed values at runtime
- 0fe5f64367bc 17.0 landed
-
Teach TID store to skip bitmap for small numbers of offsets
- f35bd9bf359d 17.0 landed
-
Use bump context for TID bitmaps stored by vacuum
- 8a1b31e6e596 17.0 landed
-
Fix alignment of stack variable
- 0ea51bac3802 17.0 landed
-
Use TidStore for dead tuple TIDs storage during lazy vacuum.
- 667e65aac354 17.0 landed
-
Rethink create and attach APIs of shared TidStore.
- 2d8f56dabbfd 17.0 landed
-
Fix inconsistent function prototypes with function definitions.
- a0e22ef9114b 17.0 landed
-
Fix a calculation in TidStoreCreate().
- 4edb37e322a6 17.0 landed
-
Fix potential integer handling issue in radixtree.h.
- 80d5d4937c16 17.0 landed
-
Add TIDStore, to store sets of TIDs (ItemPointerData) efficiently.
- 30e144287a72 17.0 landed
-
Fix link error for test_radixtree module on Windows
- ab6ae6260372 17.0 landed
- 9552e3ace317 17.0 landed
-
Blind attempt to fix ODR violations
- 1f1d73a8b83f 17.0 landed
-
Fix incorrect format specifier for int64
- e444ebcb85c0 17.0 landed
-
Fix redefinition of typedefs
- ac234e6377dd 17.0 landed
-
Add template for adaptive radix tree
- ee1b30f128d8 17.0 landed
-
Fix signedness error in 9f225e992 for gcc
- de7c6fe8347a 17.0 landed
-
Introduce helper SIMD functions for small byte arrays
- 9f225e992bed 17.0 landed
-
Optimize vacuuming of relations with no indexes.
- c120550edb86 17.0 cited
-
Add bound check before bsearch() for performance
- bbaf315309ed 14.0 cited
-
Allocate consecutive blocks during parallel seqscans
- 56788d2156fc 14.0 cited