arXiv:2610.22310cs.DBOct 2026

Manuscript Offprint

arXiv:2610.22310

TraHist: Fast and Accurate Cardinality Estimation for Trajectory Data (Extended Version)

Yujeong Jo, Incheol Baek, Changbeom Shim, Yon Dohn Chung

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

YUJEONG JO, Korea University, Republic of Korea

INCHEOL BAEK, Korea University, Republic of Korea

CHANGBEOM SHIM †^{\dagger}, Curtin University, Australia

YON DOHN CHUNG ∗^{*}, Korea University, Republic of Korea

Cardinality estimation is fundamental for query optimization in database systems. Histogram-based estimators are widely used for their simplicity and efficiency but rely on point-centric partitioning that assumes record independence. This assumption breaks in trajectory data, where records from the same moving object show strong spatiotemporal dependencies. Conventional axis-aligned histograms therefore fragment trajectories across partition boundaries, leading to overestimation through duplicate counting. This error reflects a structural limitation of partition boundaries that are misaligned with trajectory-induced density patterns. To this end, we propose TraHist, a histogram-based estimator approximating density-aligned partitioning via efficient grid-based propagation. TraHist builds density-adaptive rectilinear buckets to preserve trajectory continuity and local density coherence while keeping histogram efficiency. Experiments on large-scale real-world datasets show that TraHist reduces estimation error by over 20×20\times relative to the strongest competing estimator in query regimes where trajectory fragmentation is a dominant source of estimation error, while maintaining sub-millisecond query latency and competitive construction cost.

CCS Concepts: • Information systems → Database query processing; Spatial-temporal systems.

Additional Key Words and Phrases: Trajectory data, Cardinality estimation, Multi-dimensional Histogram

1 Introduction

In database systems, cardinality estimation is the task of estimating the number of records that satisfy a query predicate [31]. It is a fundamental component of query optimization, as inaccurate estimates can lead to suboptimal execution plans and unpredictable query performance [19]. This problem becomes particularly challenging when query predicates are evaluated over datasets with strong correlations among records. Such correlations are inherent in trajectory data, where sequences of records generated by the same moving object form strong spatiotemporal dependencies [33, 39]. Consequently, range predicates select multiple records originating from the same object, challenging conventional estimators.

Most cardinality estimators in modern database query optimizers rely on histograms as compact synopses to summarize data distributions [19]. These methods partition the data space using axis-aligned boundaries and estimate query results by aggregating counts from buckets intersecting the query predicate [5, 12, 13, 21, 24, 28, 29]. This abstraction implicitly treats records as independent points, assuming that partition boundaries preserve their semantic interpretation across buckets. While such an assumption is reasonable for uncorrelated point data, it breaks down in trajectory

∗^{*}This is the extended version of the paper “TraHist: Fast and Accurate Cardinality Estimation for Trajectory Data,” to appear in Proc. ACM Manag. Data 4, 6 (SIGMOD), Article 382 (December 2026), https://doi.org/10.1145/3856377. This version additionally includes the full appendices.

†^{\dagger}Changbeom Shim and Yon Dohn Chung are the corresponding authors.

Authors' Contact Information: Yujeong Jo, joyujeong960@korea.ac.kr, Korea University, Seoul, Republic of Korea; Incheol Baek, inch307@korea.ac.kr, Korea University, Seoul, Republic of Korea; Changbeom Shim, changbeom.shim@curtin.edu.au, Curtin University, Bentley, Australia; Yon Dohn Chung, ydchung@korea.ac.kr, Korea University, Seoul, Republic of Korea.

Figure

This work is licensed under a Creative Commons Attribution 4.0 International License.

382:2

Yujeong Jo, Incheol Baek, Changbeom Shim, and Yon Dohn Chung

Figure

(a) Point-centric Partitioning

Figure

(b) Trajectory Fragmentation

Figure

(c) Trajectory-aware Partitioning

Fig. 1. Trajectory fragmentation in point-centric partitioning and the motivation for trajectory-aware partitioning. (a) Point-centric histograms treat trajectory records as independent points, while (b) axis-aligned boundaries (red lines) cut trajectories, causing fragmentation. (c) Trajectory-aware partitioning instead adapts boundaries to data patterns, preserving object-level continuity.

workloads. As shown in Figure 1, a single trajectory may intersect multiple buckets as it traverses the data space, causing records from the same object to be assigned to different buckets. Under bucket-wise aggregation, these records are treated as separate contributions, leading to duplicate counting of the same object [4, 7, 26]. Crucially, this overestimation does not arise from overly coarse partitioning or insufficient bucket-level accuracy. Even when bucket summaries are accurate, object-level continuity remains fragmented at partition boundaries.

Although existing approaches to cardinality estimation improve accuracy through more expressive summaries or models, they primarily focus on capturing data distributions of individual records. Traditional multi-dimensional histograms [1, 5, 12, 13, 24, 28, 29] enhance estimation accuracy by refining bucket boundaries to better capture local data distributions or adapt to query feedback. Learned multi-dimensional histogram (LHist) [21] further improves accuracy by learning more expressive models within buckets, while still relying on axis-aligned partitioning. In contrast, model-based learned cardinality estimators [11, 18, 36] do not depend on histogram-style space partitioning, but instead use trained models to directly predict cardinality from input predicates. While effective for modeling high-dimensional data distributions, these approaches focus on attribute-level correlations within records and do not capture inter-record dependencies arising from spatiotemporal continuity in trajectories. Moreover, such methods typically require model training and inference at estimation time, which departs from the lightweight, training-free nature of histogram-based estimators. As a result, prior work leaves open the question of how to design partition boundaries that respect trajectory continuity while retaining histogram efficiency.

To address this gap, we propose TraHist, a histogram-based cardinality estimator designed for trajectory data. TraHist revisits histogram partitioning from the perspective of object-level continuity, constructing partitions that adapt to trajectory traversal patterns. By aligning partition boundaries with trajectory-induced density structures, our method alleviates fragmentation of individual trajectories across buckets and improves the representativeness of data grouped within each bucket. This design is guided by an idealized partitioning criterion we term density-aligned partitioning, which aims to align partition boundaries with trajectory-induced density variations. In practice, TraHist approximates this criterion in a scalable manner by constructing density-adaptive rectilinear buckets compatible with efficient histogram-based estimation.

In summary, we make the following contributions.

  • We analyze a fundamental limitation of point-centric, axis-aligned histogram partitioning for trajectory data, which fragments trajectories and degrades bucket representativeness.

382:3

  • We establish density-aligned partitioning as a design principle, providing an idealized criterion for addressing both structural and statistical deficiencies of existing histograms.

  • We propose TraHist, a trajectory-aware histogram-based cardinality estimator that approximates density-aligned partitioning by constructing density-adaptive rectilinear buckets.

  • We conduct extensive experiments on large-scale real-world trajectory datasets, showing that TraHist achieves significantly higher estimation accuracy than existing methods while maintaining fast query performance and competitive construction cost.

Appendix A summarizes the notations used throughout the paper.