Re: [PoC] Improve dead tuple storage for lazy vacuum
Masahiko Sawada <sawada.mshk@gmail.com>
On Mon, Mar 13, 2023 at 10:28 PM John Naylor <john.naylor@enterprisedb.com> wrote: > > On Mon, Mar 13, 2023 at 8:41 AM Masahiko Sawada <sawada.mshk@gmail.com> wrote: > > > > On Sun, Mar 12, 2023 at 12:54 AM John Naylor > > <john.naylor@enterprisedb.com> wrote: > > > > > > On Fri, Mar 10, 2023 at 9:30 PM Masahiko Sawada <sawada.mshk@gmail.com> wrote: > > > > > * Additional size classes. It's important for an alternative of path > > > > compression as well as supporting our decoupling approach. Middle > > > > priority. > > > > > > I'm going to push back a bit and claim this doesn't bring much gain, while it does have a complexity cost. The node1 from Andres's prototype is 32 bytes in size, same as our node3, so it's roughly equivalent as a way to ameliorate the lack of path compression. > > > > But does it mean that our node1 would help reduce the memory further > > since since our base node type (i.e. RT_NODE) is smaller than the base > > node type of Andres's prototype? The result I shared before showed > > 1.2GB vs. 1.9GB. > > The benefit is found in a synthetic benchmark with random integers. I highly doubt that anyone would be willing to force us to keep binary-searching the 1GB array for one more cycle on account of not adding a size class here. I'll repeat myself and say that there are also maintenance costs. > > In contrast, I'm fairly certain that our attempts thus far at memory accounting/limiting are not quite up to par, and lacking enough to jeopardize the feature. We're already discussing that, so I'll say no more. I agree that memory accounting/limiting stuff is the highest priority. So what kinds of size classes do you think we need? node3, 15, 32, 61 and 256? > > > > I say "roughly" because the loop in node3 is probably noticeably slower. A new size class will by definition still use that loop. > > > > I've evaluated the performance of node1 but the result seems to show > > the opposite. > > As an aside, I meant the loop in our node3 might make your node1 slower than the prototype's node1, which was coded for 1 member only. Agreed. > > > > > * Node shrinking support. Low priority. > > > > > > This is an architectural wart that's been neglected since the tid store doesn't perform deletion. We'll need it sometime. If we're not going to make this work, why ship a deletion API at all? > > > > > > I took a look at this a couple weeks ago, and fixing it wouldn't be that hard. I even had an idea of how to detect when to shrink size class within a node kind, while keeping the header at 5 bytes. I'd be willing to put effort into that, but to have a chance of succeeding, I'm unwilling to make it more difficult by adding more size classes at this point. > > > > I think that the deletion (and locking support) doesn't have use cases > > in the core (i.e. tidstore) but is implemented so that external > > extensions can use it. > > I think these cases are a bit different: Doing anything with a data structure stored in shared memory without a synchronization scheme is completely unthinkable and insane. Right. > I'm not yet sure if deleting-without-shrinking is a showstopper, or if it's preferable in v16 than no deletion at all. > > Anything we don't implement now is a limit on future use cases, and thus a cause for objection. On the other hand, anything we implement also represents more stuff that will have to be rewritten for high-concurrency. Okay. Given that adding shrinking support also requires maintenance costs (and probably new test cases?) and there are no use cases in the core, I'm not sure it's worth supporting it at this stage. So I prefer either shipping the deletion API as it is and removing the deletion API. I think that it's a discussion point that we'd like to hear feedback from other hackers. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.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