Berkeley DB:类似目录键的 btree 前缀比较?
我将使用看起来很像目录路径的键(“/foo/bar”、“/foo/baz”等,斜杠级别通常<10)来索引 BDB。
有人有使用 Btree 前缀比较例程 [1] 的经验吗?节省下来的钱值得吗?有关于这个主题的经验论文参考吗?
[1] http://www.stanford .edu/class/cs276a/projects/docs/berkeleydb/ref/am_conf/bt_prefix.html
I'm going to index a BDB with keys that look a lot like directory paths ('/foo/bar', '/foo/baz', etc, with levels of slashes generally < 10).
Does anybody have any experience with using a Btree prefix comparison routine[1] for this? Are the savings worthwhile? Any references to experience papers on this subject?
[1] http://www.stanford.edu/class/cs276a/projects/docs/berkeleydb/ref/am_conf/bt_prefix.html
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能想在此处将问题发布到 OTN 上的 Berkeley DB 论坛。有一个由支持、工程和 BDB 应用程序开发人员组成的活跃社区,他们可以在该论坛中直接互动。
我从客户和我们自己在BDB XML产品中使用Btree前缀的情况来看,它可以显着减少内部btree节点的大小,同时还提高了缓存的效率,减少了I/O,从而提高了效率单个键查找。 此处有关 btree 前缀函数的文档中也对此进行了说明。性能改进的程度取决于 a) 您的数据,b) 您的应用程序数据访问模式。如果键值大部分相同,那么您将在 btree 索引中节省更多空间。如果您的数据访问模式执行许多键查找,并且通过使用较小的 btree 可以减少必须执行的 I/O 数量,则性能将相应提高。
请注意,如果您提供 btree 前缀函数,您还必须提供兼容的 btree 比较函数。
对于 BDB XML,我们看到 btree 大小减少了 20-30。
Berkeley DB 中默认使用的词典键比较/前缀函数可能已经提供了您想要的行为。
祝你的研究顺利。
You may want to post your question to the Berkeley DB forum on OTN here. There is a active community of Support, Engineering and BDB application developers that interact directly in this forum.
What I've heard from customers and our own use of Btree prefixing in the BDB XML product is that it can significantly reduce the size of the internal btree nodes, also improving the efficiency of the cache, reducing I/O and thereby improving the efficiency of individual key lookups. This is also stated in the documentation about the btree prefix function located here. The extent of the performance improvement depends on a) your data, b) your application data access patterns. If the key value is mostly identical, then you will save more space in your btree index. If your data access patterns perform many key lookups and by having a smaller btree you reduce the number of I/Os that you have to perform, the performance will improve commensurately.
Please note that if you provide a btree prefix function you must also provide a compatible btree comparison function.
For BDB XML we saw a 20-30 reduction in btree size.
The lexicographic key comparison/prefix functions with are used by default in Berkeley DB may already be providing the behavior that you want.
Good luck with your research.