惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Docker
F
Fortinet All Blogs
爱范儿
爱范儿
博客园 - Franky
MyScale Blog
MyScale Blog
罗磊的独立博客
博客园 - 三生石上(FineUI控件)
B
Blog
P
Proofpoint News Feed
IT之家
IT之家
宝玉的分享
宝玉的分享
D
DataBreaches.Net
S
SegmentFault 最新的问题
Microsoft Azure Blog
Microsoft Azure Blog
GbyAI
GbyAI
M
MIT News - Artificial intelligence
L
LangChain Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
月光博客
月光博客
雷峰网
雷峰网
Stack Overflow Blog
Stack Overflow Blog
量子位
V
V2EX
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻

LWN.net comments

tcmalloc's weird hack [LWN.net] Fixed? [LWN.net] mpd [LWN.net] Userspace AX.25 [LWN.net] RIP [LWN.net] My two cents... [LWN.net] pipx [LWN.net] Tragedy [LWN.net] A young man destined for glory [LWN.net] And 'less' won't let you search [LWN.net] A great loss [LWN.net] Sad and shocking news [LWN.net] Easy migration from Clementine [LWN.net] Sad coincidence [LWN.net] GNOME is actually usable thanks to Seth et al [LWN.net] Sad news :( [LWN.net] armhf supports preempt_rt [LWN.net] MusicBrainz accurracy [LWN.net] On open source maintainership [LWN.net] Let's stop here [LWN.net] Not a new thing [LWN.net] uv is indeed great pgmoneta Some comments on this on a Postgres blog feed [LWN.net] uv [LWN.net] going to Debian [LWN.net] Upgrading 64-bit-capable systems to 64-bit kernels? [LWN.net] Free Software foundations Maintainers can wait for code review but not for publish review? A reasonably extreme point of view [LWN.net]
Rationale for the pseudo-random threshold? [LWN.net]
Wol · 2026-05-05 · via LWN.net comments

Rationale for the pseudo-random threshold?

Posted May 5, 2026 14:54 UTC (Tue) by Wol (subscriber, #4433)
In reply to: Rationale for the pseudo-random threshold? by marcH
Parent article: Version-controlled databases using Prolly trees
to post comments

Rationale for the pseudo-random threshold?

Posted May 5, 2026 22:12 UTC (Tue) by marcH (subscriber, #57642) [Link] (6 responses)

I'm not wondering about hashes. I'm wondering about the _threshold_ hashes are compared against. Why and how that threshold is variable. Hashes should be "variable enough" already, no? I most likely missed something.

Rationale for the pseudo-random threshold?

Posted May 6, 2026 7:00 UTC (Wed) by daroc (editor, #160859) [Link] (5 responses)

The threshold is variable to change the distribution of node sizes. If you use a fixed threshold, you get a lopsided distribution where the mean node is half-full but the modal node only has one or two elements. It's more efficient to have a low threshold for earlier items and a higher threshold for later items so that you can make the distribution of node sizes follow a bell curve.

Rationale for the pseudo-random threshold?

Posted May 6, 2026 14:05 UTC (Wed) by Wol (subscriber, #4433) [Link] (4 responses)

Rationale for the pseudo-random threshold?

Posted May 6, 2026 15:52 UTC (Wed) by farnz (subscriber, #17727) [Link]

While a good hash should have a flat distribution across all possible inputs (because all output values are equally likely), it should not have a mode at all (since all values are equally likely), and thus will not form Gaussian noise automatically (the form of noise that gives you a bell curve, where the mode is well-defined and equal to the mean). Instead, the distribution of noise you get by using a hash function is an artefact of the data you supplied to the hash function; for non-adversarial inputs (e.g. where you've keyed the hash so an attacker can't control the input to the hash function), the mean should be approximately half the maximum value, but the distribution is still unknown.

Because the hash distribution is an artefact of the input data, you need some way to ensure that an unfortunate distribution of hashes won't result in nodes that are consistently too large or too small. The simplest way to do this reliably is to vary the threshold for the next node split point based on the size of previous nodes - if the average node so far has been too small, adjust the threshold to get larger nodes in future, while if the average node has been too large, adjust the threshold to get smaller nodes in future.

More complex strategies also exist for setting the threshold - I've not looked to see how Dolt handles this - but the key to why you need a varying threshold is simply that the shape of the distribution of hash values is unknown.

Rationale for the pseudo-random threshold?

Posted May 6, 2026 15:56 UTC (Wed) by daroc (editor, #160859) [Link] (2 responses)

Rationale for the pseudo-random threshold?

Posted May 6, 2026 23:01 UTC (Wed) by Wol (subscriber, #4433) [Link] (1 responses)

Rationale for the pseudo-random threshold?

Posted May 15, 2026 19:33 UTC (Fri) by zachmu (guest, #183605) [Link]