arXiv:2603.02941cs.DBcs.IR2026-03

Timehash高效索引营业时间,大幅压缩存储且零误差。

Timehash: Hierarchical Time Indexing for Efficient Business Hours Search

  • 分层哈希策略融合倒排索引,按需细化时间粒度。
  • 索引项减少97.8%,每条记录仅9.6项,零漏检错检。
  • 适合高并发位置搜索,支持复杂营业时段与跨午夜范围。

时间范围过滤在大规模搜索系统中至关重要,尤其在基于营业时间筛选商户的场景中。传统方法存在查询延迟高、索引膨胀或精度下降的问题。PostgreSQL TSRANGE配合GiST索引虽可精确匹配,但在10万至100万规模下延迟达15-224毫秒,不适用于交互式搜索,且无法嵌入倒排索引流程。本文提出Timehash,一种分层时间索引算法,在保持100%精度的同时,相比分钟级索引降低97%以上索引大小。基于生产环境18个月运行的1260万条记录分析,提出基于边界分布的层级选择方法;在Yelp开放数据集(12.7万美加商户)上验证,相同5级层次将总索引项压缩至1分钟基准的0.77%(生产数据为2.17%)。在单Elasticsearch部署下对比原生BKD,Timehash在典型多条件top-K查询(K≤100)中实现1.14-2.17倍更低的P50延迟,大K值时因文档生成主导趋于收敛。五级结构(4小时、1小时、15分钟、5分钟、1分钟)使每条记录索引项降至9.6个,压缩率达46倍,且无误报或漏报。索引开销随10万到1260万地理点数保持稳定,支持间歇时段、非规则排班及跨越午夜的时间区间。

原文摘要 · Abstract (English)

Temporal range filtering is critical in large-scale search systems, particularly location-based services filtering businesses by operating hours. Traditional approaches suffer from poor query performance (scope filtering), index size explosion (minute-level indexing), or reduced precision (coarse-grained indexing). PostgreSQL TSRANGE with GiST indexing offers exact semantics but imposes P50 latencies of 15-224 ms at 100K-1M scale, prohibitive for interactive search, and cannot embed within inverted index pipelines. We present Timehash, a hierarchical time indexing algorithm achieving over 97% reduction in index size versus minute-level indexing while maintaining 100% precision. Timehash uses a flexible multi-resolution strategy that integrates seamlessly into inverted index infrastructure. Through analysis of 12.6 million records from a production location search service deployed for 18 months, we demonstrate a domain-informed hierarchy-selection methodology via boundary-distribution analysis, with cross-dataset validation on the Yelp Open Dataset (127K US/CA businesses), where the same 5-level hierarchy reduces total terms to 0.77% of the 1-minute baseline (vs. 2.17% on the production dataset). We evaluate Timehash against naive inverted approaches, PostgreSQL GiST, and a within-Elasticsearch BKD baseline. On Yelp within a single Elasticsearch deployment with matched indexing, Timehash achieves 1.14-2.17x lower P50 latency than native BKD on production-typical multi-predicate top-K workloads (K <= 100), with methods converging at large K where document materialization dominates. A five-level hierarchy (4h, 1h, 15m, 5m, 1m) reduces index terms to 9.6 per document, a 97.8% reduction and 46x compaction, with zero false positives and zero false negatives. Per-doc cost stays constant from 100K to 12.6M POIs while supporting break times, irregular schedules, and midnight-spanning ranges

时间索引倒排索引搜索优化营业时间

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。