gpt4 book ai didi

mongodb - MongoDB如何实现它的空间索引?

转载 作者:IT老高 更新时间:2023-10-28 13:27:16 25 4
gpt4 key购买 nike

The current implementation encodes geographic hash codes atop standard MongoDB B-trees. Results of $near queries are exact. One limitation with this encoding, while fast, is that prefix lookups don't give exact results, especially around bit flip areas. MongoDB solves this by doing a grid-neighbor search after the initial prefix scan to pick up any straggler points. This generally ensures that performance remains very high while providing correct results.

这是否意味着mongodb将地球分成了几个网格?

最佳答案

Greg Studer (10gen) 的这个演示文稿详细讨论了地理空间索引: Geospatial Indexing with MongoDB .

MongoDB 2.2 中的标准地理空间实现使用二维 GeoHash方法,精度可变:

By default, precision is set to 26 bits which is equivalent to approximately
2 feet given (longitude, latitude) location values and default (-180, 180)
bounds.

GeoHash 方法确实存在一些边缘情况,其中一些点可能在空间上很接近,但具有不同的哈希值。 MongoDB 还包括一个 Geospatial Haystack Index它专门针对具有一个附加索引条件的小区域“近”长/纬度搜索进行了调整(例如:“查找 25 英里内名称为 'foo' 的所有餐厅”)。

Nicholas Knize (Thermopylae) 的另一个有趣的演示将当前的 B-tree/GeoHash 方法与 R-trees 进行了对比。 .如果您向前跳到幻灯片 8,则有一个可视化的解释可能会有所帮助: RTree Spatial Indexing with MongoDB - MongoDC .

关于mongodb - MongoDB如何实现它的空间索引?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12492065/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com