Manuscript Offprint
arXiv:2610.22310TraHist: Fast and Accurate Cardinality Estimation for Trajectory Data (Extended Version)
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 , 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 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.
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.

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

(a) Point-centric Partitioning

(b) Trajectory Fragmentation

(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.
2.1 Trajectory Data and Query
We consider trajectory datasets consisting of movement records generated by distinct objects over a spatial domain . Each object produces a sequence of spatial samples as it moves through the domain. Most existing DBMSs store and index trajectory data using point-based abstractions, treating individual samples as records, while many spatial queries are defined with respect to entire trajectories rather than individual points [9, 33].
Definition 2.1 (Trajectory). A trajectory is defined as an ordered sequence of spatial points sampled from the movement of a single object, i.e., , where each point represents a spatial location [33]. We write for the polyline induced by , i.e., the piecewise-linear spatial representation obtained by connecting consecutive samples in order.
Definition 2.2 (Trajectory Range Query). Given a trajectory dataset and a spatial range , a trajectory range query returns the set of trajectories whose polylines intersect :
The trajectory-level cardinality is defined as the number of distinct trajectories returned by the query, i.e., .
The query predicate is defined over , whereas a point-centric synopsis is constructed from sampled points in . The directly observable sample-hit condition such that identifies only a subset of : it misses intersections that occur along a segment between consecutive samples. This gap widens as trajectories are sampled sparsely relative to . Moreover, bucket-wise aggregation of sampled points can treat contributions from the same trajectory independently and count that trajectory multiple times across buckets. TraHist targets and estimates it from sample-derived point-density and distinct-trajectory statistics.
In this work, we focus on spatial trajectory range CE: timestamps determine the ordering of the sampled points in T, and hence , but do not appear in the query predicate. Spatiotemporal range predicates additionally constrain time and therefore define a distinct CE problem with temporal semantics. Within this spatial setting, we target the standard INTERSECTS predicate, defined in terms of the DE-9IM [25]. More specific topological relations for trajectories [3] define cardinality functions beyond our target; Appendix B discusses the additional statistics required for their cardinality estimation and how the INTERSECTS estimate can support their query processing.
2.2 Cardinality Estimation Problem
Cardinality estimation typically summarizes a dataset with a compact synopsis that supports efficient query optimization. Histograms are widely used synopses: they partition the data domain into a finite set of disjoint regions, called buckets, and store a representative statistic for each bucket.
382:4
Yujeong Jo, Incheol Baek, Changbeom Shim, and Yon Dohn Chung

Answer = 2, Estimate =
(a) Trajectory Fragmentation

Conventional Histogram (MEH)
(b) Loss of Density Coherence
Fig. 2. Limitations of conventional histogram-based estimators for trajectory data. (a) Fragmented Trajectories: A trajectory split across multiple buckets is counted multiple times under independent bucket aggregation. (b) Loss of density coherence: On real trajectory data (Porto), axis-aligned buckets aggregate regions with substantially different densities (regions A and B in ), undermining bucket-level summaries.
Given a query workload W, the objective of a histogram H is to minimize the estimation error, subject to a constraint on the number of buckets, which corresponds to a memory budget. The estimation error is defined as
where is the true cardinality for a query , is the cardinality estimated by the estimator function associated with the histogram . The function denotes an error metric.
In this work, we focus on histogram-based cardinality estimation for trajectory range queries. Specifically, for a query with spatial range , given a partitioning and an estimator function , the goal is to estimate the true trajectory-level cardinality using .
3 Motivations
Conventional histogram-based cardinality estimators summarize data distributions using compact partitions under assumptions of record independence and local uniformity. In trajectory workloads, however, applying such axis-aligned partitioning to sampled trajectory points gives rise to two structural factors that conventional histogram partitioning cannot address simultaneously. One factor originates from ignoring dependencies among samples from the same trajectory, resulting in trajectory fragmentation that leads to duplicate counting under bucket-wise aggregation (Section 3.1). The other is caused by biased and spatially correlated density patterns of trajectories, which undermine the formation of locally coherent partitions (Section 3.2). These two factors are illustrated in Figure 2. Constructing effective histograms for trajectory data therefore requires jointly accounting for both object-level continuity and density heterogeneity.
3.1 Fragmented Trajectories
A defining characteristic of trajectory data is that sampled points generated by the same object are dependent and jointly induce the polyline . However, histogram-based estimators adopt a point-centric abstraction, treating these dependent samples as independent points during both partitioning and estimation. Under axis-aligned rectangular partitioning, may cross multiple bucket boundaries, causing sampled points from the same trajectory to be assigned to different buckets. We refer to this loss of object-level continuity as trajectory fragmentation.
382:5
The origin of trajectory fragmentation lies in the geometric mismatch between axis-aligned bucket boundaries and the dominant directions of trajectory movement. Consider a regular axis-aligned grid with cell width and a segment of with length oriented at an angle with respect to the -axis. The expected number of grid boundary crossings is proportional to . This quantity is minimized when the segment is aligned with a coordinate axis and maximized when it is diagonal to the grid axes.
Trajectory fragmentation directly impacts cardinality estimation under point-centric aggregation. Consider a trajectory whose sampled points are assigned to buckets that overlap . Although should contribute exactly once to , histogram-based estimators aggregate its bucket-level contributions independently, yielding up to contributions instead of one. Figure 2a shows a trajectory whose points fall into several buckets overlapping , each of which contributes a separate count for the same trajectory to the aggregated estimate. This error persists even when individual buckets accurately summarize local point statistics, as it arises from fragmented object-level aggregation rather than estimation noise within buckets.
A natural intuition is to mitigate this error by grouping regions traversed by the same trajectory into a single bucket. However, enforcing continuity alone fundamentally alters the role of histogram partitions. Buckets formed solely to preserve trajectory continuity may span spatially heterogeneous regions, aggregating records from distinct areas of the domain and degrading the reliability of bucket-level summaries. This analysis indicates that trajectory fragmentation cannot be resolved by naïve continuity-preserving partitioning without regard to local density coherence.
3.2 Loss of Density Coherence in Buckets
A core objective of histogram-based estimators is to construct partitions in which bucket contents can be accurately summarized by representative statistics during query estimation. This objective fundamentally depends on the homogeneity of data distributions within individual buckets and directly influences the global estimation error defined in Section 2.2. Let denote the local trajectory point density (points per unit area) at location x. For a bucket B, the degree of density heterogeneity can be quantified by the intra-bucket variance , defined by:
where represents the average density within bucket , and denotes the area of . A core design goal of histogram-based estimators is therefore to construct partitions that keep low, ensuring that bucket-level summaries provide accurate representations of local data distributions during query estimation.
This objective is particularly difficult in trajectory datasets due to the biased and spatially correlated nature of trajectory-induced point densities. Individual trajectories vary in length, speed, and orientation, and collectively induce highly anisotropic spatial density patterns. Rather than forming compact and isotropic clusters, trajectory point density tends to concentrate along elongated paths corresponding to dominant movement directions. As a result, density coherence is largely preserved along trajectory-aligned directions, while substantial variation arises across them. Figure 2b shows axis-aligned buckets aggregating regions with substantially different trajectory point densities into a single bucket.
Independent of trajectory fragmentation, this directional density structure poses a fundamental challenge for histogram construction. Conventional axis-aligned rectangular partitions are generally misaligned with dominant density directions and therefore tend to mix regions of substantially different density within the same bucket. As a result, intra-bucket variance becomes inflated, undermining the effectiveness of representative bucket-level summaries and degrading estimation.
382:6
Yujeong Jo, Incheol Baek, Changbeom Shim, and Yon Dohn Chung

(a) Dataset

(b) CountGrid

(c) LabelMap

(d) Bucket Boundaries
Fig. 3. Overview of TraHist. (a) The raw trajectory dataset. (b) The corresponding CountGrid , representing the log-transformed density field. (c) The LabelMap produced by density-adaptive bucket formation, with each color denoting a distinct bucket. (d) The resulting rectilinear bucket boundaries overlaid on the raw data.
accuracy. Refining bucket granularity or employing more expressive bucket-level models can mitigate this effect only to a limited extent, because the underlying geometric mismatch persists unless the partition boundaries themselves are adapted to the density structure.
4 Proposed Method: TraHist
This section presents TraHist, a fast and accurate cardinality estimator for trajectory data. We first introduce density-aligned partitioning as a design principle that characterizes desirable partition boundaries for trajectory data (Section 4.1). Since directly optimizing this principle in continuous space is computationally infeasible, TraHist adopts a density-adaptive approximation based on grid-based propagation to construct rectilinear buckets (Section 4.2). Finally, we describe how the resulting histogram is used to estimate trajectory query cardinality (Section 4.3).
4.1 Density-aligned Partitioning
The fundamental challenge in trajectory cardinality estimation lies in designing a partitioning scheme that preserves trajectory continuity and maintains local density coherence. Conventional histogram partitioning schemes struggle to satisfy both objectives simultaneously, as they restrict boundaries to fixed coordinate axes that are often misaligned with the directional structure of trajectory-induced density fields. These limitations motivate the design principle that we term density-aligned partitioning.
Intuitively, a partition is density-aligned if its boundaries follow directions along which the trajectory-induced density varies minimally, instead of being tied to fixed coordinate axes. Let denote a partition of the spatial domain into regions, its boundary set, and the unit tangent vector to the boundary at location . The local density geometry is described by the gradient . The rate of density change along a boundary can be quantified by the magnitude of the inner product . Integrating this quantity over the partition boundaries with respect to arc length yields the following idealized formulation:
This objective characterizes an ideal scenario in which partition boundaries are aligned with local density geometry and follow directions of minimal density change. However, directly optimizing this formulation is computationally impractical and incompatible with the efficiency requirements of histogram-based estimators. It induces a generally non-convex, combinatorial optimization over continuous boundary configurations under global consistency constraints, with a search space that grows rapidly as spatial resolution increases.
382:7

(a) MEH

(b) MHist
Fig. 4. Axis-aligned partitioning of MEH and MHist on Porto, both with 500 buckets as in Figure 3.

(a) CountGrid
Neighbors pushed with
label 1
3 unlabeled
neighbors pushed
(b) MERGE Expansion
Next pop triggers
BOUNDARY
at (3,5)→(4,5)
D = 6.00 > τ = 5.67
D = 5.83 > τ = 5.33
label 1
label 2
label 3
(c) BOUNDARY Events
label 1
label 2
label 3
(d) LabelMap
Fig. 5. Density-adaptive propagation (Algorithm 1) on a CountGrid with and . (a) A seed is initialized at the density peak. (b) MERGE expands to neighboring cells in order of increasing accumulated contrast , covering homogeneous high-density regions. (c) When the local contrast exceeds the adaptive threshold ( ), BOUNDARY events are triggered, preventing merging across density discontinuities. (d) The resulting LabelMap forms rectilinear buckets aligned with the underlying density structure.
4.2 Density-adaptive Approximation
To make density-aligned partitioning applicable to large-scale trajectory datasets, TraHist adopts a practical approximation replacing direct continuous boundary optimization with an efficient construction on a discretized density field. TraHist approximates density-aligned partitioning through a two-stage process. It first constructs a discretized density representation (CountGrid), and then forms histogram buckets via a density-adaptive aggregation on this grid, providing a tractable surrogate for the ideal objective. The resulting pipeline, from the raw trajectory dataset to the final rectilinear bucket boundaries, is illustrated on a real-world example in Figure 3.
CountGrid Construction. TraHist partitions the spatial domain into a regular grid with cell size , and aggregates points into grid cells to obtain a cell-level representation of the trajectory-induced density field. For each cell , the CountGrid value is defined as
where is the trajectory dataset, and is the indicator function. This aggregation preserves spatial locality at a fixed resolution while making local density variation explicit, as illustrated in Figure 3b. To stabilize local density variation, TraHist applies a log transformation to the raw CountGrid values, yielding a log-transformed CountGrid density field , which serves as a discrete surrogate for the continuous density function .
Density-adaptive Bucket Formation. Given the density field , TraHist forms histogram buckets by aggregating neighboring grid cells with similar density, while explicitly detecting boundaries induced by sharp local density transitions. This process produces rectilinear partitions that adapt to local density variation while remaining compatible with grid-based estimation, as illustrated by the density-adaptive LabelMap in Figure 3c and the resulting rectilinear buckets.
382:8
Yujeong Jo, Incheol Baek, Changbeom Shim, and Yon Dohn Chung
Algorithm 1: Density-adaptive Bucket Formation
Input :Log-transformed CountGrid ; parameters , ; window size
Output: LabelMap LM and buckets
1 Compute local mean map over a window;
2 Initialize cumulative cost and LabelMap LM(x) ;
3 Initialize empty min-heap H and current label ;
4 Select an unlabeled seed s and initialize , , LM(s) ;
5 H.push((0, s));
6 while H is not empty do
7
8 if then continue; // Better path already found
9 Compute threshold via Equation (7);
10 for each neighbor do
11 Compute contrast via Equation (6);
12 if and LM(n) = -1 then // BOUNDARY: Start new bucket
13 , , LM(n) ;
14 H.push((0, n));
15 else // MERGE: Propagate current label
16 ;
17 if then
18 , LM(n) LM(x);
19 H.push(( ));
20 Group cells by LM to form buckets ;
21 return LM, ;
in Figure 3d. In contrast, Figure 4 shows conventional axis-aligned histograms, which fail to follow trajectory-induced density structures. To realize these density-adaptive partitions in practice, bucket formation proceeds by expanding from seed cells using a priority queue ordered by cumulative density contrast, causing growth to follow directions of minimal density variation. The complete density-adaptive bucket formation procedure is summarized in Algorithm 1.
At each propagation step, when the algorithm considers a neighboring cell n of a currently labeled cell x, it first evaluates whether a significant density transition should induce a bucket boundary. Figure 5 visualizes this process on a CountGrid, where propagation from a seed at the density peak produces rectilinear buckets through a sequence of MERGE and BOUNDARY decisions. Accordingly, the algorithm makes one of the following decisions:
• MERGE: By default, assign n to the same bucket as x and continue propagation;
• BOUNDARY: When a significant density transition is detected, initiate a new bucket at n. These decisions are governed by a contrast-based cost defined on adjacent grid cells. The local density contrast between neighboring cells x and n is measured by
where denotes the local mean of in a neighborhood around , and controls the balance between sensitivity to sharp local transitions and robustness to noise. The first term
382:9
captures direct density contrast between adjacent cells, while the second term anchors this contrast to the local density baseline, suppressing fluctuations caused by sparse sampling.
To determine whether propagation should continue across a cell boundary, TraHist compares with an adaptive threshold
where controls the granularity of partitioning. This approach effectively evaluates the relative contrast , providing a scale-consistent criterion that remains stable under strong density variation. In practice, values of near 1.0 yield stable partitions, while slightly larger values can suppress minor contrasts in noisy or highly imbalanced regions. For an unlabeled neighboring cell , if , BOUNDARY is triggered and initiates a new bucket; otherwise, is considered density-compatible with and MERGE is performed.
To enforce coherent bucket shapes, TraHist maintains a cumulative propagation cost , which tracks the minimum accumulated contrast required to reach each cell from its bucket seed. This cost is updated as
where denotes the neighbor cells of x. Propagation is processed in ascending order of using the priority queue, causing propagation to follow paths of least aggregate contrast. Consequently, bucket boundaries tend to align with persistent density transitions rather than isolated local fluctuations. By favoring propagation along directions of minimal density contrast and suppressing expansion across sharp transitions, this contrast-driven process provides a discrete approximation to the geometric objective in Section 4.1. Its role as a surrogate for minimizing intra-bucket variance is further analyzed in Section 5.2.
Once propagation converges, the resulting LabelMap LM induces a partition of the grid. For each bucket , TraHist additionally maintains simple bucket-level statistics, including the average number of trajectory points per cell and that of distinct trajectories per cell , which are used during cardinality estimation. These buckets form rectilinear polygons whose geometry reflects local density variation, and they are subsequently used as the histogram synopsis for cardinality estimation.
4.3 Cardinality Estimation
Given the LabelMap LM and density-adaptive buckets , TraHist estimates the trajectory-level cardinality directly from compact per-bucket statistics. Through grid-aligned sampling, TraHist maps Q to the CountGrid and aggregates the statistics of the selected cells, avoiding segment-cell intersections and geometric overlap computation over irregular bucket polygons. This design retains the benefits of density-coherent partitioning while keeping query time linear in the number of selected cells. Estimation proceeds in two stages: a point-level estimate followed by a trajectory-to-point correction for object-level dependency.
Point-level estimation. Given a query region Q, TraHist samples Q at the resolution of the CountGrid. Let denote the resulting set of selected grid cells. Each cell is assigned to a bucket using the LabelMap LM. Let denote the number of selected grid cells assigned to bucket . The point-level cardinality estimate is computed as
382:10
Yujeong Jo, Incheol Baek, Changbeom Shim, and Yon Dohn Chung
Trajectory-level estimation. To estimate the number of distinct trajectories intersecting Q, TraHist applies a ratio-based correction to account for object-level dependency among sampled points. For each bucket , a trajectory-to-point ratio is defined as
where is a small constant added for numerical stability. A query-specific weighted average ratio is then computed as
and the final trajectory-level estimate is obtained by
Beyond query-time estimation, we also consider synopsis updates under trajectory insertions and deletions. Appendix C examines this extension under a fixed partition while updating the per-bucket statistics, together with TraHist's behavior under data shift.
5 Analysis
This section analyzes TraHist from both computational and theoretical perspectives. We first examine its time and space complexity, and then discuss theoretical properties that explain how density-adaptive propagation leads to coherent bucket formation.
5.1 Computational Complexity
Let denote the number of trajectory points, N the number of grid cells in the CountGrid, and the number of grid cells covered by a query region.
Construction cost. CountGrid construction scans all trajectory points once to compute point and trajectory counts per cell, which takes time and space. Density-adaptive bucket formation then processes each grid cell while maintaining a priority queue, resulting in time and space. Since is fixed for a given dataset, the overall construction cost is effectively governed by N, which is determined by the chosen grid resolution rather than by the number of trajectories or points.
Query cost. For a query covering grid cells, TraHist aggregates per-cell labels and bucket statistics in time, as the final weighted aggregation over buckets is bounded by . Thus, per-query estimation scales linearly with the number of sampled grid cells, independent of bucket shape complexity.
Space usage. After construction, TraHist stores only the LabelMap and per-bucket statistics, requiring space determined by the grid resolution. While this is higher than the space cost of traditional histograms that store only per-bucket summaries, it remains significantly smaller than the model footprints of learned estimators.
5.2 Theoretical Properties
We now examine the structural properties induced by the proposed density-adaptive propagation. We first define the algorithmic cost implicitly minimized by the propagation process and establish local optimality. We then relate the local contrast underlying this cost to density coherence within buckets, quantified by the intra-bucket variance in Equation (3). We further derive a bound on the difference between the local contrast and the corresponding bucket-mean deviation. Full derivations are provided in Appendix D.
382:11
Algorithmic structure and local optimality of density-adaptive propagation. The propagation-based partitioning process, guided by the cumulative cost in Equation (8), can be interpreted as implicitly minimizing a global algorithmic cost. For a final partition of the domain , we define the accumulated contrast objective
which represents the total accumulated contrast required to construct the partition. Since each cell is assigned to the region that reaches it with minimum cumulative cost, reassigning a cell to a neighboring region cannot reduce , establishing local optimality.
Connection to the statistical objective. The ideal discrete statistical objective for histogram-based estimation is the intra-bucket sum of squared errors
where is the mean density within bucket . This objective serves as a statistical surrogate for cardinality estimation error under a bucket-wise mean model. When a new cell is added to , the increase in is proportional to , so minimizing this increment for a given bucket amounts to minimizing . However, using this quantity to guide propagation is computationally costly, as evolving bucket means require updating the costs of pending candidate cells. TraHist instead uses the locally computable contrast (Equation (6)) as a tractable surrogate.
Bounded deviation from the ideal objective. For a candidate cell and an adjacent cell , the deviation between and the ideal local objective is provably bounded:
where captures the maximum deviation from the local mean around cell , and measures the maximum deviation from the bucket mean within . The bound shows that the discrepancy between the practical contrast cost and the ideal local objective is controlled by two factors: local density smoothness (via and ) and intra-bucket homogeneity (via ). The first term bounds the discrepancy introduced by local averaging, while the second bounds the error from using the neighboring cell's density as a proxy for the bucket mean. For , a formal bound on in terms of the cumulative propagation cost is provided in Appendix D. Together, these bounds support the use of as a principled surrogate for minimizing , aligning the algorithmic objective with the statistical objective.
6 Experimental Study
This section presents an extensive experimental evaluation of TraHist, focusing on its accuracy, robustness, and efficiency for the cardinality estimation of trajectory range queries. Our evaluation is designed to address four research questions:
• RQ1. Does TraHist provide more accurate estimates under realistic workloads?
• RQ2. What structural properties explain its accuracy gains?
• RQ3. Does TraHist achieve these benefits with practical construction and query costs?
• RQ4. How effective are spatial-object adaptations for trajectory cardinality estimation?
All experiments were conducted on a single server running Ubuntu 24.04.3 LTS, equipped with an Intel(R) Core(TM) i9-9900X CPU and 128 GB of RAM; all estimators were implemented in Python.
382:12
Yujeong Jo, Incheol Baek, Changbeom Shim, and Yon Dohn Chung
Table 1. Statistics of the real-world trajectory datasets.
| Dataset | # Traj. | # Points | Trajectory Length |T| | ||
|---|---|---|---|---|---|
| Min | Median | Max | |||
| Porto | 1,672,257 | 80,414,709 | 2 | 41 | 3,836 |
| T-Drive | 127,159 | 17,502,090 | 2 | 36 | 98,607 |
| GeoLife | 17,335 | 20,003,131 | 2 | 487 | 56,780 |
6.1 Experimental Setup
Datasets. We use three real-world trajectory datasets that are widely adopted in prior studies on trajectory data management: Porto [17, 20, 34], T-Drive [34, 37, 38], and GeoLife [41–43]. We apply standard preprocessing to all datasets. Specifically, trajectories consisting of fewer than two points were removed. Since T-Drive does not explicitly provide trajectory identifiers, individual trajectories were reconstructed by splitting point sequences whenever the temporal gap exceeded 30 minutes. All geographic coordinates were projected into a two-dimensional planar domain using the Universal Transverse Mercator projection, converting them to a uniform, meter-based coordinate system. Table 1 summarizes the key statistics of the resulting datasets.
Porto stresses scalability and construction efficiency due to its scale, while T-Drive emphasizes trajectory continuity challenges due to its heavy-tailed trajectory length distribution. These datasets form the basis of our primary evaluation. GeoLife, in contrast, exhibits distinct sampling characteristics, with dense point distributions from high-frequency and heterogeneous sampling. It also reflects more diverse and irregular human mobility patterns than vehicular trajectories in Porto and T-Drive. Given these properties, we use GeoLife as a complementary dataset to assess the generalizability across different trajectory characteristics, and present its main results separately in Appendix E.
Compared Methods. We evaluate TraHist against five representative histogram-based estimators spanning classical partitioning, learned intra-bucket modeling, and trajectory-specific connection-aware aggregation. We separately evaluate two spatial-object adaptations in Section 6.5.
-
MEH [24]: A canonical baseline that partitions the spatial domain into axis-aligned rectangular buckets with an equal number of records.
-
MHist [29]: An iterative partitioning histogram guided by a splitting criterion that recursively divides regions where data values change the most. We adapt it to spatial data using the same CountGrid and grid cell size as TraHist to ensure identical spatial granularity.
-
LHist [21]: A hierarchical histogram that models intra-bucket distributions using local polynomial regression while retaining axis-aligned partitions.
-
DEH [35] and CASE+ [7]: Connection-aware, Euler histogram methods for counting moving objects. They improve distinct count estimation through auxiliary connectivity statistics and Euler-style aggregation over a fixed partition, without adapting partition boundaries. DEH estimates distinct connected entries via segment-wise aggregation, whereas CASE+ jointly processes all segments of each trajectory, conditionally adding virtual counts to preserve object-level connectivity. We evaluate CASE+ without its optional differential privacy.
-
Spatial-object adaptations: We evaluate two estimators using the same per-trajectory minimum bounding rectangle (MBR) representation. CDHistogram-MBR [16] applies a cumulative density histogram to the resulting MBR relation, while DeepDB-MBR [11] is
382:13
Low
(a) Porto
Medium

High
(b) T-Drive
(c) GeoLife
Fig. 6. Visualization of trajectory range queries. 1,000 query regions (blue) overlaid on (a) Porto, (b) T-Drive, and (c) GeoLife. Columns show low, medium, and high selectivity regimes based on relative query area.
a learned non-histogram estimator that models the same relation using a Sum-Product Network (SPN).
Query Workloads. We evaluate all estimators using trajectory range queries, which count the number of distinct trajectories intersecting a rectangular query region, as defined in Theorem 2.2. For each dataset, we generate a workload of trajectory range queries designed to reflect realistic, data-driven access patterns commonly observed in spatial query workloads [27, 32]. Specifically, we sample each query center from the empirical distribution of trajectory points, so regions containing more observed samples receive proportionally higher query-center probability. Figure 6 illustrates the spatial distributions of query regions generated under this workload for each dataset, further stratified by selectivity. Queries are categorized into three selectivity groups—low (0–0.5%), medium (0.5–2%), and high (2–100%)—with each group consisting of 1,000 queries [30, 36]. In general, estimation becomes more challenging as query selectivity decreases, as low selectivity queries require capturing fine-grained spatial structure [36] and are prone to large estimation errors that degrade query plan quality [19].
Comparison Strategy. To ensure fair comparisons across estimators under the defined workloads, we evaluate the histogram-based methods under two complementary evaluation settings. First, we compare methods under equivalent memory budgets. Since the storage cost of TraHist is based on the data-dependent number of emergent buckets , it cannot be fixed a priori. We therefore fix its core parameters ( , ) and vary the grid cell size to obtain a target memory budget. All other methods are configured according to their theoretical cost models to match this budget. Second, we evaluate methods under a fixed number of buckets. This setting fixes the number of buckets across methods, highlighting how different partitioning strategies capture spatial density variation and trajectory continuity. For DEH and CASE+, the controlled bucket count corresponds to the number of cells in their fixed regular grids. We report results at representative budget levels. Detailed analyses of TraHist, covering robustness, CountGrid scalability, and parameter sensitivity,
382:14
Yujeong Jo, Incheol Baek, Changbeom Shim, and Yon Dohn Chung

Fig. 7. Q-error for trajectory range queries on T-Drive. Median and tail Q-error are reported across memory budgets for (a) low (0%, 0.5%), (b) medium (0.5%, 2%), and (c) high (2%, 100%] selectivity queries.
are provided in Appendices F and G, while Appendix H extends the results reported in this section to larger budgets.
Evaluation Metrics. We evaluate estimator performance in terms of estimation accuracy, preservation of trajectory continuity, and computational efficiency.
We assess estimation accuracy primarily using the Q-error [18, 19, 23]. For a query q, let and denote the true and estimated cardinality values, respectively. The Q-error is defined as
where the ideal value is 1.0, indicating perfect estimation. Further, larger values reflect greater estimation error. To ensure numerical stability, queries where either or equals zero were excluded from Q-error analysis.
To quantify how partitioning affects trajectory continuity, we measure the trajectory fragmentation count for each trajectory . Let denote the label of the histogram bucket containing each point . Then, the fragmentation count is defined as
Intuitively, counts the number of contiguous histogram buckets visited by the sequence of trajectory points, incrementing each time it crosses a bucket boundary. Generally, lower average fragmentation indicates better preservation of trajectory continuity under the partition.
Finally, we evaluate computational efficiency using wall-clock time measurements. Estimation time is defined as the time required to compute a single cardinality estimate , whereas construction time denotes the time required to build the estimator. Throughout the experimental tables, bold and underlined values indicate the best and second-best results, respectively.
382:15
Table 2. Q-error of trajectory range query estimation on Porto, comparing estimators under matched memory budgets. Errors are summarized by selectivity using percentiles over 1,000 queries per group.
| Memory (KB) | Est. | Low (0%, 0.5%] | Medium (0.5%, 2%] | High (2%, 100%] | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 50th | 95th | 99th | Max | 50th | 95th | 99th | Max | 50th | 95th | 99th | Max | ||
| 50 | MEH | 183.6 | 7147.8 | 4.1e4 | 3.5e5 | 15.2 | 1018.3 | 4484.9 | 9.9e4 | 4.2 | 7.7 | 8.6 | 15.8 |
| MHist | 327.9 | 5504.3 | 1.5e4 | 1.1e5 | 29.4 | 996.0 | 2893.2 | 2.0e4 | 3.4 | 5.0 | 8.3 | 19.8 | |
| LHist | 35.3 | 178.7 | 384.2 | 3.1e4 | 21.0 | 161.3 | 310.0 | 2.0e4 | 1.5 | 5.4 | 21.5 | 45.4 | |
| DEH | 19.2 | 61.6 | 87.4 | 186.1 | 5.2 | 15.5 | 20.0 | 38.2 | 1.4 | 2.7 | 4.0 | 5.7 | |
| CASE+ | 50.9 | 113.7 | 160.5 | 382.0 | 11.9 | 26.6 | 34.7 | 57.3 | 1.6 | 3.5 | 4.7 | 5.9 | |
| TraHist | 5.0 | 11.1 | 27.7 | 175.6 | 1.4 | 7.9 | 16.1 | 62.8 | 2.6 | 7.9 | 18.6 | 68.3 | |
| 100 | MEH | 116.0 | 5901.7 | 2.6e4 | 2.7e5 | 10.3 | 678.9 | 3745.8 | 5.2e4 | 4.9 | 8.6 | 9.8 | 17.8 |
| MHist | 218.6 | 3295.8 | 9327.0 | 1.3e6 | 19.8 | 642.2 | 1954.4 | 3.9e5 | 4.0 | 5.8 | 9.5 | 20.9 | |
| LHist | 41.8 | 217.5 | 431.5 | 3.4e4 | 23.3 | 183.6 | 389.9 | 2.2e4 | 1.7 | 6.4 | 25.8 | 53.6 | |
| DEH | 14.7 | 51.5 | 83.8 | 179.3 | 4.2 | 13.8 | 21.6 | 38.6 | 1.4 | 2.4 | 3.4 | 5.2 | |
| CASE+ | 48.2 | 109.2 | 154.8 | 682.9 | 11.0 | 25.3 | 36.6 | 60.1 | 1.5 | 2.9 | 4.4 | 5.3 | |
| TraHist | 4.2 | 8.6 | 20.2 | 45.3 | 1.4 | 7.6 | 12.8 | 38.0 | 3.9 | 9.0 | 13.8 | 28.8 | |
| 500 | MEH | 52.1 | 1719.0 | 9772.7 | 5.7e5 | 5.4 | 219.3 | 1157.2 | 1.0e5 | 6.1 | 10.2 | 11.6 | 21.6 |
| MHist | 95.3 | 1622.3 | 5659.5 | 1.2e5 | 9.8 | 273.4 | 907.0 | 2.1e4 | 5.2 | 7.9 | 11.3 | 22.8 | |
| LHist | 64.1 | 361.3 | 843.2 | 5.1e4 | 28.1 | 320.1 | 723.2 | 3.3e4 | 2.2 | 8.4 | 31.9 | 68.6 | |
| DEH | 10.3 | 36.0 | 50.0 | 104.8 | 2.9 | 9.4 | 13.5 | 23.6 | 1.2 | 1.7 | 2.5 | 4.0 | |
| CASE+ | 42.9 | 96.3 | 127.6 | 654.8 | 7.8 | 22.0 | 27.3 | 53.4 | 1.3 | 2.4 | 3.4 | 5.0 | |
| TraHist | 1.9 | 5.3 | 14.7 | 29.8 | 2.6 | 7.5 | 12.2 | 430.2 | 5.0 | 8.5 | 10.9 | 13.8 | |
6.2 Evaluation under Fixed Memory Budgets
We evaluate the accuracy of trajectory range query cardinality estimation under the same memory budget setting. Results on Porto are summarized in Table 2, while corresponding results on T-Drive are reported in Figure 7.
6.2.1 TraHist achieves the highest accuracy for low and medium selectivity queries (RQ1). Under matched memory budgets, TraHist consistently achieves the lowest median Q-error among all estimators for low and medium selectivity queries. On Porto (Table 2), at 50 KB under low selectivity, TraHist achieves lower median Q-error than MEH and MHist, and about lower error than LHist. Across the reported budgets, TraHist reduces median Q-error relative to DEH, the strongest baseline on Porto, by under low selectivity and under medium selectivity. On T-Drive (Figure 7), it improves over the most competitive baseline by and under low and medium selectivity, respectively. The consistency of these gains across datasets with very different scale and trajectory length characteristics highlights the robustness of TraHist under fragmentation-dominated query workloads.
6.2.2 TraHist reaches low estimation error under tight memory budgets (RQ1). As memory budgets increase, estimation error generally decreases. However, methods differ in how quickly they reach practically useful accuracy-low single-digit median Q-error-under tight memory constraints.
TraHist consistently attains low absolute Q-error at substantially smaller memory budgets than competing estimators for low and medium selectivity queries. On Porto (Table 2), TraHist already achieves median Q-error values in the low single-digit range (approximately 1–3) at 500 KB. Under low selectivity, no baseline reaches this range at the same budget: all baselines remain above 10, with DEH providing the lowest median Q-error of 10.3. The gap narrows under medium selectivity, where DEH approaches TraHist at 500 KB (2.9 versus 2.6). However, TraHist reaches
382:16
Yujeong Jo, Incheol Baek, Changbeom Shim, and Yon Dohn Chung

Fig. 8. Q-error for trajectory range queries on Porto. Median and tail Q-error are reported across bucket budgets for (a) low (0%, 0.5%), (b) medium (0.5%, 2%), and (c) high (2%, 100%] selectivity queries.
the low single-digit range at tighter budgets, achieving 1.4 at both 50 and 100 KB, compared with 5.2 and 4.2 for DEH, respectively. This shows that TraHist reaches and maintains the same accuracy range with substantially less memory. A similar pattern is observed on T-Drive (Figure 7): under medium selectivity, TraHist rapidly reaches median Q-error values in the low single-digit range (approximately 1–3), while under low selectivity it remains stable in the single-digit range (approximately 6–9). These results indicate that TraHist captures the dominant spatial and trajectory-level correlations with a compact synopsis, making it particularly effective when memory is limited.
6.2.3 Accuracy differences diminish under high selectivity queries (RQ1). High selectivity queries alter the relative ranking of estimators. As query regions grow, fragmentation-induced overcounting becomes less pronounced relative to the true cardinality. On Porto, DEH achieves the lowest median Q-error, with CASE+ closely following and LHist also achieving lower error than TraHist across all reported budgets. On T-Drive, CASE+ reaches the lowest median Q-error at most budgets. TraHist remains within single-digit median Q-error across the evaluated budgets. This result is consistent with the growing relative importance of connection-aware aggregation and intra-bucket modeling as fragmentation becomes less dominant.
However, this disadvantage is considerably smaller than the gains observed under low and medium selectivity. Under high selectivity, TraHist's median Q-error is that of the most accurate estimator, whereas TraHist improves over the strongest baseline by up to and under low and medium selectivity. These results indicate that TraHist's gains concentrate in queries where fragmentation dominates estimation error.
6.3 Evaluation under Fixed Bucket Budgets
While TraHist achieves superior accuracy under matched memory budgets, that comparison alone does not reveal the structural sources of these gains. In particular, different estimators incur different per-bucket storage costs, and therefore realize substantially different numbers of buckets under the same memory constraint. To isolate the effect of partitioning structure from memory allocation, we analyze estimation accuracy and trajectory fragmentation under fixed bucket budgets, where all methods are constrained to use the same number of buckets.
382:17
Table 3. Q-error of trajectory range query estimation on T-Drive, comparing estimators under the same number of buckets. Errors are summarized by selectivity using percentiles over 1,000 queries per group.
| Buckets Est. | Low (0%, 0.5%] | Medium (0.5%, 2%] | High (2%, 100%] | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 50th | 95th | 99th | Max | 50th | 95th | 99th | Max | 50th | 95th | 99th | Max | ||
| 50 | MEH | 1580.3 | 8.7e4 | 4.6e5 | 4.0e6 | 227.0 | 1.2e4 | 6.7e4 | 8.2e6 | 3.7 | 7.7 | 25.7 | 60.8 |
| MHist | 1924.6 | 8.3e4 | 1.6e5 | 4.3e5 | 269.1 | 1.6e4 | 3.9e4 | 6.0e5 | 1.5 | 2.3 | 3.8 | 6.4 | |
| LHist | 52.2 | 331.0 | 485.6 | 2919.8 | 38.1 | 303.8 | 518.5 | 2761.3 | 1.6 | 5.4 | 19.1 | 28.0 | |
| DEH | 328.5 | 480.0 | 608.8 | 801.5 | 80.2 | 117.7 | 175.3 | 278.7 | 2.6 | 23.0 | 46.9 | 76.8 | |
| CASE+ | 183.8 | 270.7 | 343.4 | 452.0 | 45.2 | 66.4 | 98.8 | 157.2 | 1.7 | 13.0 | 27.8 | 45.1 | |
| TraHist | 7.3 | 13.2 | 23.5 | 100.1 | 1.8 | 7.7 | 23.9 | 153.9 | 4.1 | 10.0 | 37.9 | 67.3 | |
| 100 | MEH | 743.6 | 2.6e4 | 1.3e5 | 8.9e5 | 99.7 | 3677.2 | 1.7e4 | 1.2e5 | 5.4 | 10.8 | 12.0 | 20.3 |
| MHist | 1713.5 | 6.8e4 | 1.4e5 | 2.9e6 | 234.9 | 1.4e4 | 3.0e4 | 4.1e5 | 1.6 | 2.4 | 2.6 | 2.7 | |
| LHist | 57.7 | 374.7 | 549.1 | 3438.5 | 42.1 | 334.1 | 542.1 | 3251.9 | 1.3 | 8.4 | 28.4 | 43.0 | |
| DEH | 364.1 | 555.5 | 592.4 | 648.7 | 90.3 | 135.2 | 158.5 | 274.0 | 2.9 | 16.3 | 31.2 | 57.3 | |
| CASE+ | 168.8 | 257.6 | 274.7 | 300.8 | 42.0 | 62.9 | 73.5 | 127.1 | 1.6 | 8.4 | 14.9 | 33.7 | |
| TraHist | 8.4 | 13.3 | 18.4 | 34.4 | 2.1 | 7.9 | 19.2 | 233.7 | 3.4 | 9.9 | 33.6 | 87.1 | |
| 500 | MEH | 239.3 | 8391.9 | 1.7e4 | 6.2e5 | 32.0 | 1209.4 | 2391.1 | 8.7e4 | 11.8 | 23.9 | 25.7 | 26.6 |
| MHist | 798.5 | 3.5e4 | 7.3e4 | 1.5e6 | 120.4 | 6508.3 | 1.7e4 | 2.1e5 | 2.8 | 4.7 | 5.0 | 5.2 | |
| LHist | 96.8 | 574.2 | 975.9 | 4363.3 | 54.2 | 504.9 | 848.9 | 4125.0 | 3.0 | 18.6 | 68.4 | 100.1 | |
| DEH | 325.0 | 738.8 | 829.9 | 895.1 | 81.0 | 174.7 | 201.1 | 271.2 | 3.7 | 10.6 | 20.1 | 41.9 | |
| CASE+ | 101.4 | 179.2 | 199.7 | 215.4 | 25.1 | 42.9 | 49.0 | 79.6 | 1.3 | 4.3 | 7.6 | 14.9 | |
| TraHist | 7.2 | 13.9 | 25.5 | 70.2 | 1.8 | 13.5 | 25.7 | 156.0 | 2.0 | 14.8 | 32.4 | 76.8 | |
6.3.1 TraHist maintains high accuracy under fixed bucket budgets (RQ1). With the number of buckets fixed across methods, TraHist maintains high estimation accuracy, showing that its gains under matched memory budgets are not solely due to differences in bucket count. This pattern is particularly evident on T-Drive, whose long and heterogeneous trajectories amplify boundary-crossing errors when partitioning is misaligned (Table 1). As shown in Table 3, TraHist substantially outperforms all competing estimators under low and medium selectivity queries. At a bucket budget of 50, TraHist reduces the median Q-error by approximately under low selectivity and over under medium selectivity compared to LHist, while achieving one to two orders of magnitude lower error than classical histogram baselines such as MEH and MHist. Compared with the trajectory-specific baselines, DEH and CASE+, TraHist achieves lower median Q-error at 50 buckets under both low and medium selectivity regimes. The overall accuracy advantage remains substantial across 50–500 buckets. Similar trends are observed on Porto (Figure 8). DEH and CASE+ generally provide the strongest competing results among the baselines. Compared with the stronger of the two at each budget, TraHist achieves and lower median Q-error under low and medium selectivity across 50–2,000 buckets. This comparison indicates that connection-aware aggregation over a fixed grid is effective but does not fully compensate for the limitations of the underlying partition. These results further indicate that TraHist's accuracy gains are closely tied to its partitioning strategy.
6.3.2 Trajectory continuity is better preserved by TraHist under fixed bucket budgets (RQ2). To quantify how partitioning structure affects trajectory continuity, we measure the per-trajectory fragmentation count (Equation (17)), which counts the number of contiguous bucket runs into which the partition splits the sampled-point sequence of a trajectory, and is summarized using average, median, and maximum statistics.
382:18
Yujeong Jo, Incheol Baek, Changbeom Shim, and Yon Dohn Chung

Fig. 9. Trajectory fragmentation count (Eq. (17)) under controlled bucket budgets. Average, median, and maximum are shown for Porto (top) and T-Drive (bottom) as the bucket budget increases.
As shown in Figure 9, TraHist achieves the lowest average and median fragmentation across all bucket budgets. On Porto, TraHist yields only 1.3 fragments on average at 50 buckets and remains below 6 fragments even at 2,000 buckets. In contrast, MEH, MHist, and LHist exhibit moderate to high fragmentation, growing from roughly 7–24 fragments at 50 buckets to around 27–44 fragments at 2,000 buckets. DEH and CASE+ share the same regular-grid partition and therefore have identical fragmentation counts, which remain consistently higher than TraHist but lower than those of MEH, MHist and LHist. This contrast is even more pronounced on T-Drive. TraHist maintains near-contiguous trajectories with an average fragmentation close to 1 across all budgets, whereas fragmentation under the DEH/CASE+ regular grid increases from 2.9 fragments at 50 buckets to 17.1 at 2,000 buckets, and the other baselines reach 27–76 fragments. These results highlight that fragmentation is not merely reduced but effectively suppressed by our partitioning strategy.
These differences reflect the underlying partitioning strategies. MEH, MHist, and LHist optimize point-level distributions and tend to place more boundaries in dense regions, increasing crossings along heavily sampled trajectories. DEH and CASE+ distribute boundaries uniformly through a fixed regular grid, reducing this concentration but remaining trajectory-agnostic. TraHist instead adapts boundaries to trajectory-induced density structure, preserving trajectory continuity while maintaining local density coherence.
6.4 Evaluation of Computational Efficiency
Beyond accuracy, we evaluate computational efficiency to assess the practical viability of each estimator for large-scale query optimization. We consider two complementary evaluation settings: fixed memory budgets, which reflect realistic deployment scenarios, and fixed bucket budgets, which isolate the effect of partition granularity by controlling the number of buckets.
6.4.1 TraHist enables fast query estimation with low and stable latency (RQ3). Table 4 reports the average and worst-case query estimation time measured over 3,000 trajectory range queries on Porto and T-Drive under both fixed memory and bucket budgets. Query-time performance varies substantially across estimators. Under fixed memory budgets (Table 4a), DEH, CASE+, and TraHist consistently achieve sub-millisecond average latency that remains stable across all budgets. All three use lightweight grid-based query processing over precomputed statistics, while TraHist performs additional bucket mapping and trajectory-to-point correction, resulting in slightly higher latency than DEH and CASE+. MEH is the fastest estimator at small budgets but slows as the budget
382:19
Table 4. Query estimation latency (ms) under (a) fixed memory budgets (Porto: 50–500 KB, T-Drive: 5–50 KB) and (b) fixed bucket budgets. Average and worst-case (maximum) estimation times are measured across 3,000 trajectory range queries on Porto and T-Drive, covering all selectivity regimes.
(a) Fixed memory budgets
| Memory (KB) | Est. | Porto | T-Drive | ||
|---|---|---|---|---|---|
| Avg | Max | Avg | Max | ||
| 50 / 5 | MEH | 0.152 | 0.324 | 0.053 | 0.115 |
| MHist | 8.732 | 8.804 | 1.637 | 1.651 | |
| LHist | 1.211 | 2.367 | 0.710 | 1.077 | |
| DEH | 0.535 | 0.554 | 0.527 | 0.531 | |
| CASE+ | 0.548 | 0.573 | 0.530 | 0.533 | |
| TraHist | 0.572 | 0.588 | 0.570 | 0.581 | |
| 100 / 10 | MEH | 0.269 | 0.612 | 0.097 | 0.229 |
| MHist | 17.355 | 17.386 | 3.265 | 3.331 | |
| LHist | 1.542 | 3.190 | 0.810 | 1.347 | |
| DEH | 0.544 | 0.561 | 0.527 | 0.537 | |
| CASE+ | 0.559 | 0.586 | 0.539 | 0.543 | |
| TraHist | 0.577 | 0.592 | 0.564 | 0.580 | |
| 500 / 50 | MEH | 1.235 | 3.048 | 0.374 | 0.985 |
| MHist | 83.195 | 83.247 | 16.668 | 16.706 | |
| LHist | 2.912 | 6.710 | 1.304 | 2.610 | |
| DEH | 0.546 | 0.565 | 0.531 | 0.548 | |
| CASE+ | 0.561 | 0.582 | 0.546 | 0.573 | |
| TraHist | 0.581 | 0.610 | 0.571 | 0.593 | |
(b) Fixed bucket budgets
| Buckets Est. | Porto | T-Drive | |||
|---|---|---|---|---|---|
| Avg | Max | Avg | Max | ||
| 50 | MEH | 0.023 | 0.033 | 0.036 | 0.072 |
| MHist | 0.417 | 0.420 | 0.427 | 0.435 | |
| LHist | 0.958 | 1.707 | 0.988 | 1.805 | |
| DEH | 0.533 | 0.534 | 0.525 | 0.527 | |
| CASE+ | 0.540 | 0.542 | 0.535 | 0.537 | |
| TraHist | 0.566 | 0.583 | 0.569 | 0.585 | |
| 100 | MEH | 0.032 | 0.051 | 0.053 | 0.115 |
| MHist | 0.820 | 0.822 | 0.815 | 0.816 | |
| LHist | 1.453 | 2.971 | 1.538 | 3.220 | |
| DEH | 0.526 | 0.530 | 0.523 | 0.527 | |
| CASE+ | 0.537 | 0.540 | 0.540 | 0.541 | |
| TraHist | 0.567 | 0.585 | 0.564 | 0.580 | |
| 500 | MEH | 0.087 | 0.172 | 0.191 | 0.482 |
| MHist | 4.065 | 4.083 | 4.103 | 4.146 | |
| LHist | 5.167 | 12.572 | 5.577 | 13.685 | |
| DEH | 0.534 | 0.552 | 0.533 | 0.550 | |
| CASE+ | 0.549 | 0.576 | 0.547 | 0.576 | |
| TraHist | 0.571 | 0.590 | 0.567 | 0.584 | |

Fig. 10. Estimator construction time in seconds on Porto (top row) and T-Drive (bottom row), under varying memory budgets (left column) and bucket budgets (right column).
grows, whereas MHist incurs significantly higher latency that grows rapidly with the memory budget, exceeding 80 ms on Porto at 500 KB. LHist also exhibits higher latency than TraHist despite using fewer buckets under the same memory budget, due to the additional per-bucket computation required by its expressive bucket models.
Under fixed bucket budgets (Table 4b), DEH, CASE+, and TraHist maintain stable sub-millisecond average latency as the bucket budget increases, while MEH remains the fastest estimator despite increasing latency. This stability also extends to worst-case query time: while MHist and LHist
382:20
Yujeong Jo, Incheol Baek, Changbeom Shim, and Yon Dohn Chung
Table 5. Fidelity of enclosing spatial-object surrogates. Median and 95th-percentile Q-error are measured against the true trajectory range cardinality . Exact intersection counting isolates surrogate-representation error.
| Dataset | Surrogate | Low | Medium | High | |||
|---|---|---|---|---|---|---|---|
| 50th | 95th | 50th | 95th | 50th | 95th | ||
| Porto | Exact-MBR | 42.53 | 89.03 | 10.92 | 22.05 | 1.77 | 3.55 |
| Exact-ConvexHull | 20.99 | 43.44 | 5.47 | 11.30 | 1.25 | 2.13 | |
| T-Drive | Exact-MBR | 61.68 | 114.72 | 14.89 | 27.98 | 1.07 | 2.28 |
| Exact-ConvexHull | 39.85 | 88.93 | 9.70 | 21.86 | 1.03 | 1.31 | |
exhibit noticeable tail-latency growth as the bucket budget increases, DEH, CASE+, and TraHist maintain consistently low and tightly bounded latency across all evaluated settings.
These results suggest that TraHist provides predictable and stable query-time behavior—a property particularly desirable for query optimizers, where robustness to worst-case estimation latency is critical in large-scale trajectory workloads.
6.4.2 TraHist shows efficient construction with stable cost growth across bucket budgets (RQ3). Figure 10 reports construction time on Porto in the top row and T-Drive in the bottom row, with memory budgets on the left and bucket budgets on the right. Under fixed memory budgets (Figures 10a and 10c), TraHist consistently achieves the lowest construction time across all evaluated memory budgets on both Porto and T-Drive. DEH and CASE+ require approximately 46–75× longer construction time than TraHist across the evaluated budgets, reflecting the cost of constructing the additional connectivity statistics used by their connection-aware aggregation over the regular grid. MHist also exhibits a dramatic increase in construction cost as memory grows, reaching several orders of magnitude higher cost at large budgets. This behavior is consistent with the smaller per-bucket memory footprint of MHist, which allows it to realize a substantially larger number of buckets under the same memory budget.
Under fixed bucket budgets (Figures 10b and 10d), TraHist again exhibits consistently low construction overhead as bucket count increases. On Porto, construction time grows only modestly from approximately 15 s at 50 buckets to about 23 s at 2,000 buckets, while on T-Drive it remains nearly constant at around 6–7 s. The competing estimators exhibit different cost characteristics: DEH and CASE+ maintain substantially higher construction costs across all bucket budgets, whereas MHist and LHist become increasingly expensive as the number of buckets grows. MEH remains comparatively lightweight, but generally requires more construction time than TraHist.
6.5 Comparison with Spatial-Object Estimators
Generic spatial-object estimators can be adapted to trajectory range CE by replacing each trajectory with a spatial surrogate and estimating . We consider two representative choices for : the per-trajectory minimum bounding rectangle (MBR) and convex hull. Since the resulting surrogate cardinality may differ from the target cardinality defined over the original trajectory geometry , we first evaluate surrogate fidelity using exact counting. We then examine whether accurate MBR cardinality estimation translates into accurate end-to-end trajectory estimates of .
6.5.1 Surrogate fidelity limits spatial-object adaptations under selective queries (RQ4). Table 5 first isolates surrogate-representation error using exact intersection counts over per-trajectory MBRs and convex hulls. Exact-MBR yields low selectivity median Q-errors of 42.53 on Porto and 61.68 on
382:21
Table 6. Comparison of spatial-object adaptations and TraHist. Each entry reports median Q-error against the exact MBR cardinality and , shown as . DeepDB-MBR denotes the configuration with the lowest low selectivity MBR Q-error.
| Method | Porto | T-Drive | ||||||
|---|---|---|---|---|---|---|---|---|
| Memory | Median Q-error (MBR/|RQ(Q)|) | Memory | Median Q-error (MBR/|RQ(Q)|) | |||||
| Low | Medium | High | Low | Medium | High | |||
| Exact-MBR (reference) | — | 1.00 / 42.53 | 1.00 / 10.92 | 1.00 / 1.77 | — | 1.00 / 61.68 | 1.00 / 14.89 | 1.00 / 1.07 |
| CDHistogram-MBR | 50 KB | 1.02 / 42.16 | 1.03 / 10.67 | 1.02 / 1.76 | 50 KB | 1.05 / 59.63 | 1.05 / 14.56 | 1.03 / 1.04 |
| DeepDB-MBR | 103 MB | 1.00 / 42.41 | 1.00 / 10.90 | 1.00 / 1.77 | 8 MB | 1.01 / 61.52 | 1.01 / 14.77 | 1.00 / 1.07 |
| TraHist | 50 KB | — / 5.00 | — / 1.40 | — / 2.60 | 50 KB | — / 6.70 | — / 1.70 | — / 1.50 |
T-Drive. Exact-ConvexHull reduces these errors by 1.5–2.0×, but they remain substantial at 20.99 and 39.85, since even a tighter enclosure includes untraversed regions. Under high selectivity, both surrogates become substantially more accurate, with median Q-errors ranging from 1.03 to 1.77.
Table 6 next examines whether accurate MBR cardinality estimation removes this representation error. CDHistogram-MBR is evaluated under the same 50 KB memory budget as TraHist. For DeepDB-MBR, we vary the RDC threshold and dataset-appropriate slice sizes. Since DeepDB-MBR does not produce histogram buckets and its SPNs require substantially more memory, we report the configuration with the lowest low-selectivity median Q-error against Exact-MBR at its corresponding model size (103 MB on Porto and 8 MB on T-Drive). Both methods estimate the MBR cardinality nearly exactly, with native median Q-errors of 1.00–1.05, yet their end-to-end errors remain close to the Exact-MBR reference. This identifies the trajectory-to-MBR representation, rather than estimator error, as the dominant error source under low and medium selectivity.
Compared with the evaluated MBR-based estimators, TraHist achieves 7.6–9.2× lower median Q-error under low and medium selectivity, while its median Q-error is 1.4–1.5× higher under high selectivity. This contrast indicates that TraHist's accuracy advantage is concentrated in selective queries, where preserving local trajectory support is critical.
7 Related Work
Multi-dimensional Histograms. Histograms are fundamental synopsis structures for selectivity estimation. Traditional data-driven histograms [12, 13, 24, 28, 29] partition the data domain into axis-aligned rectangular buckets. Workload-aware extensions such as STGrid [1] and STHoles [5] refine histogram buckets using query feedback to adapt to frequently accessed regions, focusing on workload patterns rather than intrinsic data characteristics. Our work is complementary to these workload-aware extensions, focusing on data-driven synopses independent of access patterns. More recently, LHist [21] incorporates machine learning models to approximate intra-bucket distributions while preserving the same rectangular partitioning framework. Despite these advances, existing methods largely retain axis-aligned bucket constraints, which limit their ability to capture complex or directional data distributions. Our work addresses this core limitation by fundamentally improving the partitioning strategy itself.
Histograms for Moving Objects. Several studies [6, 7, 10, 35] have extended histograms to moving objects. Spatiotemporal histograms [6, 10] incorporate velocity information into their bucket representations to estimate the selectivity of queries involving the future positions of moving objects, whereas TraHist focuses on trajectory-aware spatial partitioning for range cardinality estimation. DEH [35] and CASE [7] address the distinct-counting problem [4, 8, 22, 26]—the
382:22
Yujeong Jo, Incheol Baek, Changbeom Shim, and Yon Dohn Chung
overcounting of objects across partition boundaries—by maintaining explicit connection metadata between adjacent partitions to post-hoc correct for overcounting during aggregation, in distributed sensing and privacy-aware settings, respectively. However, these methods operate on a given partitioning and do not optimize the partition structure itself. TraHist instead structurally reduces fragmentation by aligning boundaries with trajectory-induced density patterns.
Learned Cardinality Estimation for Relational Data. Learned estimators [11, 18, 36] use trained neural or probabilistic models to predict cardinalities from query predicates or to approximate the underlying data distribution. These approaches either model complex correlations or learn directly from query workloads and often achieve high accuracy on relational workloads. However, their original formulations estimate cardinalities for predicates over relational tuples rather than trajectory polylines. In contrast, TraHist is designed for trajectory range CE without training.
Spatial Cardinality Estimation. Spatial CE has been studied for point range queries [14], rectangular objects and spatial joins [2, 16], and polygon-intersection queries [15]. These methods natively estimate cardinalities over different spatial units and therefore do not directly target the trajectory range cardinality considered in this work. Point-based methods estimate the number of points contained in Q, whereas applying object-based methods to trajectories requires replacing each polyline with a spatial-object surrogate , such as an MBR or an enclosing polygon. The resulting surrogate cardinality can differ from when intersects Q in a region not traversed by . We evaluate this distinction in Section 6.5 using exact MBR and convex hull surrogates, CDHistogram-MBR [16], and DeepDB-MBR [11]. TraHist instead targets trajectory range CE without collapsing each trajectory into a single enclosing object.
Acknowledgments
This work was partly supported by the Institute of Information & Communications Technology Planning & Evaluation (IITP) grants funded by the Korea government (MSIT) (IITP-2026-RS-2020-II201819, ICT Creative Consilience Program; RS-2026-25522620), the National Research Foundation of Korea (NRF) grants funded by the Korea government (MSIT) (RS-2026-25616569 and RS-2026-25494942), and the NRF grant funded by the Ministry of Education (RS-2021-NR060143, Basic Science Research Program).
References
[1] Ashraf Aboulnaga and Surajit Chaudhuri. 1999. Self-Tuning Histograms: Building Histograms Without Looking at Data. In Proceedings of the ACM SIGMOD International Conference on Management of Data. ACM, 181–192.
[2] Ning An, Zhen-Yu Yang, and Anand Sivasubramaniam. 2001. Selectivity Estimation for Spatial Joins. In Proceedings 17th International Conference on Data Engineering. 368–375.
[3] Johann Bornholdt, Theodoros Chondrogiannis, and Michael Grossniklaus. 2026. Trajectory Data Management: A Data Model and Predicate Logic with Operators for Spatio-Temporal Query Processing. Information Systems 135 (2026), 102595. doi:10.1016/j.is.2025.102595
[4] Fernando Braz, Salvatore Orlando, Renzo Orsini, Alessandra Raffaeta, Alessandro Roncato, and Claudio Silvestri. 2007. Approximate Aggregations in Trajectory Data Warehouses. In Proceedings of the IEEE International Conference on Data Engineering Workshops (ICDEW). IEEE, 536–545.
[5] Nicolas Bruno, Surajit Chaudhuri, and Luis Gravano. 2001. STHoles: A Multidimensional Workload-Aware Histogram. In Proceedings of the ACM SIGMOD International Conference on Management of Data. ACM, 211–222.
[6] Yong-Jin Choi and Chin-Wan Chung. 2002. Selectivity estimation for spatio-temporal queries to moving objects. In Proceedings of the 2002 ACM SIGMOD international conference on Management of data. 440–451.
[7] Maryam Fanaeepour, Lars Kulik, Egemen Tanin, and Benjamin I. P. Rubinstein. 2015. The CASE Histogram: Privacy-Aware Processing of Trajectory Data Using Aggregates. GeoInformatica 19, 4 (2015), 747–798.
[8] Leticia Gómez, Bart Kuijpers, Bart Moelans, and Alejandro Vaisman. 2011. A State-of-the-Art in Spatio-Temporal Data Warehousing, OLAP and Mining. In Integrations of Data Warehousing, Data Mining and Database Technologies: Innovative Approaches. IGI Global Scientific Publishing, 200–236.
382:23
[9] Anita Graser. 2018. Evaluating Spatio-temporal Data Models for Trajectories in PostGIS Databases. GI_Forum, Journal of Geographic Information Science 6, 1 (2018), 16–33. doi:10.1553/giscience2018_01_s16
[10] Marios Hadjieleftheriou, George Kollios, and VT Tsotras. 2003. Performance evaluation of spatio-temporal selectivity estimation techniques. In 15th International Conference on Scientific and Statistical Database Management, 2003. IEEE, 202–211.
[11] Benjamin Hilprecht, Andreas Schmidt, Moritz Kulessa, Alejandro Molina, Kristian Kersting, and Carsten Binnig. 2020. DeepDB: Learn from Data, Not from Queries! Proceedings of the VLDB Endowment 13, 7 (2020), 992–1005.
[12] Yannis E. Ioannidis and Viswanath Poosala. 1995. Balancing Histogram Optimality and Practicality for Query Result Size Estimation. In Proceedings of the ACM SIGMOD International Conference on Management of Data. ACM, 233–244.
[13] H. V. Jagadish, Nick Koudas, S. Muthukrishnan, Viswanath Poosala, Kenneth C. Sevcik, and Torsten Suel. 1998. Optimal Histograms with Quality Guarantees. In Proceedings of the International Conference on Very Large Data Bases (VLDB). Morgan Kaufmann, 275–286.
[14] Yuchen Ji, Daichi Amagata, Yuya Sasaki, and Takahiro Hara. 2024. SAFE: Sampling-Assisted Fast Learned Cardinality Estimation for Dynamic Spatial Data. In International Conference on Database and Expert Systems Applications. 201–216.
[15] Yuchen Ji, Daichi Amagata, Yuya Sasaki, and Takahiro Hara. 2025. PolyCard: A Learned Cardinality Estimator for Intersection Queries on Spatial Polygons. Journal of Intelligent Information Systems 63, 3 (2025), 873–891.
[16] Ji Jin, Ning An, and Anand Sivasubramaniam. 2000. Analyzing range queries on spatial data. In Proceedings of 16th International Conference on Data Engineering (Cat. No. 00CB37073). IEEE, 525–534.
[17] Kaggle. 2015. ECML/PKDD 15: Taxi Trajectory Prediction (I). https://www.kaggle.com/c/pkdd-15-predict-taxi-service-trajectory-i. Accessed: 2026-01-27.
[18] Andreas Kipf, Thomas Kipf, Bernhard Radke, Viktor Leis, Peter A. Boncz, and Alfons Kemper. 2019. Learned Cardinalities: Estimating Correlated Joins with Deep Learning. In Proceedings of the Conference on Innovative Data Systems Research (CIDR).
[19] Viktor Leis, Andrey Gubichev, Atanas Mirchev, Peter Boncz, Alfons Kemper, and Thomas Neumann. 2015. How Good Are Query Optimizers, Really? Proceedings of the VLDB Endowment 9, 3 (2015), 204–215.
[20] Dongjiang Liu, Leixiao Li, and Jie Li. 2024. A Trajectory Similarity Computation Method Based on GAT-Based Transformer and CNN Model. Scientific Reports 14, 1 (2024), 16173. doi:10.1038/s41598-024-67256-7
[21] Qiyu Liu, Yanyan Shen, and Lei Chen. 2021. LHist: Towards Learning Multi-Dimensional Histogram for Massive Spatial Data. In Proceedings of the IEEE International Conference on Data Engineering (ICDE). IEEE, 1188–1199.
[22] Becky PY Loo. 2006. Validating crash locations for quantitative spatial analysis: a GIS-based approach. Accident Analysis & Prevention 38, 5 (2006), 879–886.
[23] Guido Moerkotte, Thomas Neumann, and Gabriele Steidl. 2009. Preventing bad plans by bounding the impact of cardinality estimation errors. Proceedings of the VLDB Endowment 2, 1 (2009), 982–993.
[24] M. Muralikrishna and David J. DeWitt. 1988. Equi-Depth Histograms For Estimating Selectivity Factors For Multi-Dimensional Queries. In Proceedings of the ACM SIGMOD International Conference on Management of Data. ACM, 28–36. doi:10.1145/50202.50205
[25] Open Geospatial Consortium. 2011. OpenGIS Implementation Standard for Geographic Information—Simple Feature Access—Part 1: Common Architecture. Technical Report OGC 06-103r4. Open Geospatial Consortium. Version 1.2.1.
[26] Salvatore Orlando, Renzo Orsini, Alessandra Raffaeta, Alessandro Roncato, and Claudio Silvestri. 2007. Spatio-Temporal Aggregations in Trajectory Data Warehouses. In Proceedings of the International Conference on Data Warehousing and Knowledge Discovery (DaWaK). Springer, 66–77.
[27] Bernd-Uwe Pagel, Hans-Werner Six, Heinrich Toben, and Peter Widmayer. 1993. Towards an analysis of range query performance in spatial data structures. In Proceedings of the twelfth ACM SIGACT-SIGMOD-SIGART symposium on Principles of database systems. 214–221.
[28] Viswanath Poosala, Peter J. Haas, Yannis E. Ioannidis, and Eugene J. Shekita. 1996. Improved Histograms for Selectivity Estimation of Range Predicates. In Proceedings of the ACM SIGMOD International Conference on Management of Data. ACM, 294–305.
[29] Viswanath Poosala and Yannis E. Ioannidis. 1997. Selectivity Estimation Without the Attribute Value Independence Assumption. In Proceedings of the International Conference on Very Large Data Bases (VLDB). Morgan Kaufmann, 486–495.
[30] Nazanin Rashedi and Guido Moerkotte. 2025. The Accuracy of Cardinality Estimators: Unraveling the Evaluation Result Conundrum. Proceedings of the VLDB Endowment 18, 11 (2025), 3744–3756.
[31] P. Griffiths Selinger, Morton M. Astrahan, Donald D. Chamberlin, Raymond A. Lorie, and Thomas G. Price. 1979. Access Path Selection in a Relational Database Management System. In Proceedings of the ACM SIGMOD International Conference on Management of Data. ACM, 23–34.
[32] Michael Shekelyan, Anton Dignös, and Johann Gamper. 2017. Digithist: a histogram-based data summary with tight error bounds. Proceedings of the VLDB Endowment 10, 11 (2017), 1514–1525.
382:24
Yujeong Jo, Incheol Baek, Changbeom Shim, and Yon Dohn Chung
[33] Sheng Wang, Zhifeng Bao, J. Shane Culpepper, and Gao Cong. 2021. A Survey on Trajectory Data Management, Analytics, and Learning. Comput. Surveys 54, 2 (2021), 39:1–39:36. doi:10.1145/3440207
[34] Sheng Wang, Zhifeng Bao, J. Shane Culpepper, Timos Sellis, and Xiaolin Qin. 2019. Fast Large-Scale Trajectory Clustering. Proceedings of the VLDB Endowment 13, 1 (2019), 29–42.
[35] Hairuo Xie, Egemen Tanin, and Lars Kulik. 2007. Distributed histograms for processing aggregate data from moving objects. In 2007 International Conference on Mobile Data Management. IEEE, 152–157.
[36] Zongheng Yang, Eric Liang, Amog Kamsetty, Chenggang Wu, Yan Duan, Xi Chen, Pieter Abbeel, Joseph M. Hellerstein, Sanjay Krishnan, and Ion Stoica. 2019. Deep Unsupervised Cardinality Estimation. Proceedings of the VLDB Endowment 13, 3 (2019), 279–292.
[37] Jing Yuan, Yu Zheng, Xing Xie, and Guangzhong Sun. 2011. Driving with knowledge from the physical world. In Proceedings of the 17th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining. ACM, 316–324.
[38] Jing Yuan, Yu Zheng, Chengyang Zhang, Wenlei Xie, Xing Xie, Guangzhong Sun, and Yan Huang. 2010. T-drive: Driving directions based on taxi trajectories. In Proceedings of the 18th SIGSPATIAL International Conference on Advances in Geographic Information Systems. ACM, 99–108.
[39] Yu Zheng. 2015. Trajectory Data Mining: An Overview. ACM Transactions on Intelligent Systems and Technology 6, 3 (2015), 1–41.
[40] Yu Zheng, Hao Fu, Xing Xie, Wei-Ying Ma, and Quannan Li. 2011. GeoLife GPS Trajectory Dataset User Guide. Microsoft Research. https://www.microsoft.com/en-us/research/publication/geolife-gps-trajectory-dataset-user-guide/
[41] Yu Zheng, Quannan Li, Yukun Chen, Xing Xie, and Wei-Ying Ma. 2008. Understanding mobility based on GPS data. In Proceedings of the 10th international conference on Ubiquitous computing. 312–321.
[42] Yu Zheng, Xing Xie, and Wei-Ying Ma. 2010. GeoLife: A collaborative social networking service among user, location and trajectory. IEEE Data Eng. Bull. 33, 2 (2010), 32–39.
[43] Yu Zheng, Lizhu Zhang, Xing Xie, and Wei-Ying Ma. 2009. Mining interesting locations and travel sequences from GPS trajectories. In Proceedings of the 18th international conference on World wide web. 791–800.
382:25
Table A1. Summary of frequent notations.
| Notation | Description | Notation | Description |
|---|---|---|---|
| Spatial & Trajectory Basics | |||
| Spatial domain | Trajectory dataset | ||
| A trajectory, | A trajectory point, | ||
| Piecewise-linear spatial representation of | |||
| Grid & Density Metrics | |||
| Regular spatial grid (CountGrid) | A grid cell in | ||
| Raw point count in grid cell | Continuous trajectory-induced point density at location | ||
| Log-transformed density value at grid cell | Local mean of around | ||
| Partitioning & Bucket Formation | |||
| Partition of the spatial domain | The -th histogram bucket | ||
| LabelMap assigning grid cell to bucket | Neighboring grid cells of | ||
| Query & Cardinality Estimation | |||
| Spatial range query region | Set of trajectories whose induced polylines intersect | ||
| True trajectory-level cardinality of query | Estimated trajectory-level cardinality of query | ||
A Notation Reference
This section provides a summary of the notations used throughout the paper (Table A1).
B Topological Predicates Beyond INTERSECTS
TraHist targets the INTERSECTS predicate in Theorem 2.2, counting the distinct trajectories whose polyline shares at least one point with the query region . More specific spatial range queries may ask whether is WITHIN , meaning that the complete polyline lies in and is not entirely on its boundary; whether it CROSSES , passing through its interior while also extending outside ; or whether it TOUCHES , meeting the boundary without entering the interior. Each predicate selects a different subset of the trajectories that intersect , and therefore defines a distinct cardinality function rather than a rescaling of the intersection count. These relationships are defined through the interiors, boundaries, and exteriors of the two geometries under the standard topological model [25].
TraHist's synopsis consists of the LabelMap and two summaries for each bucket: the average point count per cell and the average distinct trajectory count per cell . These local summaries do not capture trajectory identifiers across cells or buckets, complete trajectory extent, segment connectivity or orientation, or contact with a query boundary. Determining whether an individual trajectory satisfies the other topological predicates may require its points, endpoints, and connecting segments. [3] formulate such predicates using recorded samples, endpoints, and, when necessary, the straight-line segments between consecutive samples. TraHist instead estimates cardinalities from a compact synopsis, so extending it to these predicates would require aggregate summaries of the corresponding trajectory and segment information.
For WITHIN, local counts inside and outside do not reveal whether they belong to the same trajectories. For an axis-aligned rectangular , the coordinate extrema of each trajectory determine exactly whether . Estimating this condition without storing one
382:26
Yujeong Jo, Incheol Baek, Changbeom Shim, and Yon Dohn Chung
extent tuple per trajectory would require a separate aggregate synopsis over these four correlated values. Additional geometric information would be needed to exclude trajectories that lie entirely on the boundary of Q. For CROSSES, local counts inside and outside Q likewise do not indicate whether the same trajectory has support on both sides of the query boundary. Candidate summaries could record distinct trajectory transitions between neighboring cells or buckets, grouped by transition direction or segment orientation, and aggregate them along the query boundary. Since one trajectory may generate several transition events, the current trajectory-to-point ratio cannot be applied directly; a separate correction from transition events to distinct trajectories would be required. For TOUCHES, a cell intersected by the query boundary may contain both a segment that enters the interior of Q and one that only contacts its boundary. Distinguishing these cases requires finer summaries of segment position and orientation that the current and do not have.
Collectively, these requirements indicate that the existing partition can organize some additional local statistics, but does not by itself provide all information required by the other predicates. Nevertheless, any trajectory satisfying WITHIN, CROSSES, or TOUCHES also satisfies INTERSECTS. The result set of each predicate is therefore contained in . A query plan may first form a candidate set of trajectories intersecting Q and then evaluate the additional topological condition on these candidates. In such a plan, TraHist estimates the intermediate candidate cardinality, providing an input for costing candidate generation and the subsequent geometric evaluation. Estimating the reduction from the intersecting candidates to the final result would still require the additional statistics described above. Thus, the method and claims of this paper remain limited to INTERSECTS, while its estimates can also support query processing for more specific topological predicates.
C Updating TraHist
This section examines maintenance of TraHist’s per-bucket statistics under trajectory updates and its accuracy under data shifts. We consider three strategies: No refresh reuses both the LabelMap and per-bucket statistics; Statistics only fixes the initial LabelMap while updating the statistics for the current trajectories; and Full rebuild reconstructs the CountGrid, LabelMap, and statistics from the current trajectories. Section C.1 describes exact insertion and deletion under a fixed LabelMap, while Section C.2 compares these strategies under a controlled data shift.
C.1 Exact Maintenance under a Fixed LabelMap
Under Statistics only, TraHist fixes the spatial domain, CountGrid cell size , and LabelMap while updating the per-bucket statistics. For each bucket , let be its number of CountGrid cells, the sum of their point counts, and the sum of their distinct trajectory counts. The original means are recovered exactly as and , so the maintained synopsis consists of the LabelMap and . Relative to the original synopsis, this replaces with and and adds only . The CountGrid is temporary workspace for full rebuilds and is not stored afterward.
For a whole trajectory , let be the number of its sampled points mapped to , and let be the number of distinct CountGrid cells in occupied by these points. Inserting adds to and to , while deleting subtracts the same quantities. The occupied cell count is required because averages cell-level distinct trajectory counts. These updates maintain and exactly under the fixed LabelMap. Exact deletion requires either the previous trajectory record or an auxiliary per-trajectory record of and for its visited buckets; the latter is maintained outside the compact query synopsis. A modification is processed as deletion followed by insertion, while updates outside the fixed domain require grid extension or reconstruction.
382:27
Table C1. Maintenance under a fixed LabelMap. State includes the LabelMap and . Upd. pts reports inserted and deleted points per checkpoint; Speedup is rebuild time divided by maintenance time. Values span five checkpoints.
| Dataset | State (KB) | Upd. pts (M) | Maint. (s) | Rebuild (s) | Speedup |
|---|---|---|---|---|---|
| Porto | 53.8–54.2 | 15.2–16.6 | 10.1–10.8 | 23.4–26.6 | 2.3–2.5× |
| T-Drive | 64.4–64.7 | 3.1–3.8 | 1.2–1.4 | 3.2–3.4 | 2.5–2.8× |
| GeoLife | 57.4–59.7 | 3.2–4.7 | 1.0–1.4 | 2.7–3.2 | 1.9–3.0× |

Fig. C1. Estimation error under a controlled data shift on Porto. Median (top) and 95th percentile (bottom) trajectory-level Q-error are shown for low, medium, and high selectivity as 0–100% of the initial trajectories are replaced. Lines compare No refresh, Statistics only, and Full rebuild.
Table C1 reports the synopsis state and processing cost of incremental maintenance and compares it with rebuilding TraHist at the same checkpoint. We use the CountGrid cell sizes that produce approximately 50 KB TraHist synopses on the full datasets, fix their spatial domains, and provide the previous trajectory record for each deletion. Each checkpoint replaces approximately one fifth of the stored trajectories while keeping their total number nearly constant, involving 3.1–16.6 million inserted and deleted points. The process time includes computing and from these records and applying the per-bucket updates, but excludes record retrieval and access to the optional per-trajectory structure. Adding increases the original 49.1–55.0 KB synopsis by 6.2–17.9%, yielding the 53.8–64.7 KB states reported in the table. Incremental maintenance takes 1.0–10.8 seconds and is 1.9–3.0× faster than full rebuild because it reuses the fixed LabelMap and avoids CountGrid construction and bucket formation.
C.2 Accuracy under Data Shift
To evaluate TraHist under a controlled data shift, we use the update protocol and approximately 50 KB configurations from Section C.1. We apply PCA to trajectory centroids solely to order trajectories by their projection onto the first principal component, divide them into approximately equal groups, and replace these groups sequentially. This gradually shifts the distribution along its dominant spatial direction. Starting from checkpoint 0, five updates increase trajectory replacement from 20% to 100%.
382:28
Yujeong Jo, Incheol Baek, Changbeom Shim, and Yon Dohn Chung
Table C2. Trajectory-level Q-error before and after complete trajectory replacement. Initial is shared across modes; other columns show checkpoint 5. Full rebuild may produce a different bucket count.
| Dataset | Sel. | 50th Q-error | 95th Q-error | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Initial | No ref. | Maint. | Rebuild | Initial | No ref. | Maint. | Rebuild | ||
| Porto | Low | 5.9 | 12.6 | 5.6 | 6.3 | 40 | 727 | 127 | 53 |
| Med | 2.3 | 5.7 | 2.3 | 2.2 | 14 | 452 | 43 | 15 | |
| High | 3.3 | 5.3 | 3.2 | 3.3 | 11 | 501 | 30 | 16 | |
| T-Drive | Low | 9.4 | 10.5 | 8.3 | 10.2 | 42 | 92 | 83 | 43 |
| Med | 2.8 | 3.0 | 2.4 | 2.9 | 12 | 77 | 75 | 14 | |
| High | 1.7 | 1.5 | 1.4 | 1.7 | 14 | 129 | 199 | 22 | |
| GeoLife | Low | 10.5 | 12.5 | 7.4 | 6.3 | 113 | 150 | 96 | 90 |
| Med | 2.8 | 4.9 | 2.4 | 2.2 | 30 | 79 | 24 | 19 | |
| High | 2.6 | 3.3 | 3.4 | 3.4 | 36 | 236 | 105 | 47 | |
No refresh and Statistics only share the fixed LabelMap and differ only in whether the per-bucket statistics are updated, so their comparison isolates the effect of stale statistics under the same partition. Full rebuild instead reconstructs the partition from the current trajectories under the same spatial domain and construction parameters. Since the resulting bucket count is data-dependent, the rebuilt synopsis can differ in size; this comparison therefore measures the practical benefit of rebuilding rather than a partition-only effect under an identical synopsis size.
Figure C1 shows how these differences develop as the shift accumulates on Porto. Before any trajectories are replaced, the three strategies coincide, and with limited replacement their differences remain small and show no consistent ordering. As more trajectories are replaced, however, leaving the synopsis unchanged substantially increases estimation error. At complete replacement, the median Q-errors under Statistics only are 5.6, 2.3, and 3.2 for low, medium, and high selectivity, respectively, close to the 6.3, 2.2, and 3.3 obtained under Full rebuild; No refresh yields 12.6, 5.7, and 5.3. The difference is larger in the tail: the corresponding 95th percentile Q-errors are 53, 15, and 16 under Full rebuild, 127, 43, and 30 under Statistics only, and 727, 452, and 501 under No refresh.
Table C2 shows that this complete-replacement pattern extends across the three datasets. Across the nine dataset and selectivity combinations, the median Q-error under Statistics only remains close to that under Full rebuild, with their ratio ranging from 0.81 to 1.19. Statistics only also lowers the 95th percentile Q-error relative to No refresh in eight of the nine combinations, while Full rebuild achieves the lowest 95th percentile error in all nine. Thus, updating only the per-bucket statistics generally provides median accuracy comparable to Full rebuild at lower processing cost, whereas rebuilding TraHist becomes preferable after substantial trajectory replacement when tail accuracy is important.
D Derivations for Theoretical Properties
This appendix presents the derivations underlying the theoretical results in Section 5.2.
Local optimality. For the final partition , consider reassigning a cell to a neighboring region while keeping the seed locations and local contrast costs unchanged. We compare the minimum cumulative costs of reaching the cell from its current region and from the neighboring region. During propagation, TraHist updates a cell's cumulative cost whenever a path with a lower cost is found and reinserts the cell into the priority queue. Thus, at termination, holds for every pair of adjacent cells. Each cell's stored cost is the accumulated contrast along the propagation path that assigns its label. Applying this inequality along propagation paths shows
382:29
that no alternative path has lower cost than the stored value. Consequently, reassigning a cell to a neighboring region cannot reduce , establishing local optimality.
Marginal cost of cell assignment. Let
denote the mean density within bucket . When a new cell is added to , the increase in the intra-bucket SSE objective (Equation (14)) is
Thus, minimizing amounts to minimizing . TraHist replaces this with the locally computable contrast (Equation (6)), which avoids recomputing bucket means at each step.
Proof of the deviation bound (Equation (15)). For a candidate cell and an adjacent cell , expanding (Equation (6)) and applying the triangle inequality with respect to the bucket mean yields
The last inequality follows from , , and the definitions of , , and in Section 5.2. The first term arises from local smoothing, while the second term reflects intra-bucket non-uniformity.
Bounding via cumulative propagation cost. For , let be the seed of and define . For any cell , each edge along its propagation path from contributes at least to . Repeated application of the triangle inequality yields
Since lies between the extrema of within , it follows that
Together with Equation (15), this bound provides a theoretical basis for using as a surrogate for the ideal local objective, with approximation error controlled by local density variation and cumulative propagation cost.
E Estimation Accuracy on the GeoLife Dataset
To assess the consistency of TraHist accuracy beyond traffic trajectory datasets, we evaluate on the GeoLife dataset, which captures diverse human mobility patterns—including walking, cycling, bus, and driving—from 182 users in the Beijing metropolitan area [40, 43]. Unlike Porto and T-Drive, which primarily capture structured vehicular movements, GeoLife exhibits greater heterogeneity in trajectory length and sampling frequency. This contrast provides a complementary test of whether TraHist's accuracy trends persist beyond road-constrained vehicular trajectories.
Figures E1 and E2 report the Q-error results under fixed memory and fixed bucket budgets, respectively. Consistent with the main experiments, TraHist achieves substantially lower estimation error than competing methods under low and medium selectivity queries across all evaluated
382:30
Yujeong Jo, Incheol Baek, Changbeom Shim, and Yon Dohn Chung

Fig. E1. Q-error for trajectory range queries on GeoLife. Median and tail Q-error are reported across memory budgets for (a) low (0%, 0.5%), (b) medium (0.5%, 2%), and (c) high (2%, 100%] selectivity queries.

Fig. E2. Q-error for trajectory range queries on GeoLife. Median and tail Q-error are reported across bucket budgets for (a) low (0%, 0.5%), (b) medium (0.5%, 2%), and (c) high (2%, 100%] selectivity queries.
settings. In the high selectivity regime, the accuracy gap between estimators narrows, consistent with the trends observed on Porto and T-Drive (Section 6.2.3). TraHist continues to achieve single-digit median Q-error across all configurations on GeoLife, ranging from 2.1 to 3.8, and remains within 1.4× of the lowest median at every budget. Its median accuracy advantage over LHist is more pronounced than on the taxi datasets: TraHist yields 2×–9× lower median Q-error than LHist across all memory and bucket budgets on GeoLife, whereas on Porto and T-Drive LHist occasionally attains lower median error at large query scales. The tail ranking differs, however: CASE+ achieves the lowest 99th percentile and maximum Q-error at every evaluated budget and the lowest 95th percentile Q-error at most budgets. Thus, TraHist remains competitive in median accuracy, while CASE+ provides stronger tail control under high selectivity.
382:31

Fig. F1. Median Q-error of TraHist under trajectory subsampling. Parentheses show the percentage of retained points. The CountGrid cell size is ; in the legend, indicates , with values in meters. marks the additional smaller cell size.
We attribute these patterns to two factors. First, the heterogeneous trajectory distribution in GeoLife likely limits the effectiveness of LHist's intra-bucket regression models in capturing local density variation, preserving TraHist's relative advantage. Second, CASE+'s stronger tail control under high selectivity is consistent with the reduced role of fragmentation as query regions span more buckets. Overall, these results confirm that the accuracy benefits of TraHist persist across datasets with fundamentally different trajectory characteristics, including both road-constrained vehicle trajectories and heterogeneous human mobility data.
F Robustness and Scalability Analysis
To evaluate the robustness and scalability of TraHist, we examine trajectory subsampling and query region size across varying CountGrid cell sizes , and assess the accuracy and resource costs as decreases. We also examine whether a sparse storage representation can mitigate the storage growth associated with smaller CountGrid cells without changing the underlying partition. Unless otherwise specified, we use , , and .
F.1 Robustness to Trajectory Subsampling
To evaluate TraHist under increasingly sparse samples, we retain every k-th point of each trajectory for , while preserving both endpoints. For each k and , we rebuild TraHist using the setup in Section 6, while keeping the spatial domain, query workload, and ground truth cardinalities computed from the non-subsampled trajectories fixed. For each dataset, Figure F1 reports three grid cell sizes corresponding to the memory budgets used in our main and extended
382:32
Yujeong Jo, Incheol Baek, Changbeom Shim, and Yon Dohn Chung

(a) Porto
Query side length s (m) (median selectivity, %)
(b) T-Drive
(c) GeoLife
Fig. F2. Median Q-error under varying query side length s and CountGrid cell size . The cyan lines connect the evaluated query sizes closest to and , where . Parenthesized values report median selectivity (%). marks the additional smallest cell size.
evaluations, together with one additional smaller cell size (marked ) without a corresponding target memory budget.
TraHist remains robust to trajectory subsampling across the evaluated cell sizes. At , only 4.62%, 2.74%, and 1.69% of the original points remain on Porto, T-Drive, and GeoLife, respectively. Even under this aggressive subsampling, median Q-error remains low across most evaluated memory budgets on all three datasets, and high selectivity estimates are affected even less, remaining stable across subsampling strides and cell sizes. Together, these results indicate that the aggregate CountGrid retains sufficient spatial density information for accurate estimation even when only a small fraction of trajectory samples is retained.
The accuracy retained under subsampling remains competitive even against estimators built from the full trajectories. On T-Drive and GeoLife, TraHist at remains the most accurate estimator across all evaluated memory budgets under low and medium selectivity. At 50 KB, its median Q-error is and lower than LHist and CASE+ under low and medium selectivity, respectively, on T-Drive, and and lower than CASE+ on GeoLife. On Porto at 50 KB, TraHist achieves lower median Q-error than DEH under low selectivity and comparable accuracy under medium selectivity (5.3 versus 5.2). Notably, these comparisons favor the competing estimators, which use all trajectory points, whereas TraHist uses only a small fraction of them.
Subsampling degrades accuracy when becomes sufficiently small that each CountGrid cell retains too few points to represent its local density, an effect most apparent on Porto under low and medium selectivity. At , increasing from 1 to 64 raises the median Q-error from 1.90 to 11.41 under low selectivity and from 2.60 to 23.40 under medium selectivity, and the additional smaller cell size further increases the corresponding values to 40.91 and 61.30. Across the evaluated range, T-Drive and GeoLife show substantially weaker resolution dependence. This contrast shows that the effect of subsampling varies with CountGrid resolution rather than uniformly with the retained sample count.
Overall, TraHist remains robust to substantial subsampling across a broad range of cell sizes, with degradation occurring mainly when fine-grid cells contain too few observations. Its accuracy therefore depends primarily on CountGrid resolution relative to the retained sampling density rather than on sample count alone.
382:33
Table F1. Query-size sensitivity at the coarsest matched-memory and additional finest () CountGrid resolutions, near and . Sel., Med., and Log denote median selectivity (%), median Q-error, and median ; negative and positive Log indicate under- and overestimation.
| Dataset | (m) | ||||||
|---|---|---|---|---|---|---|---|
| Sel. | Med. | Log | Sel. | Med. | Log | ||
| Porto | 210 | 4.05 | 2.87 | -1.37 | 12.36 | 2.18 | +1.13 |
| 1.81 | 13.66 | -3.77 | 3.31 | 1.92 | -0.81 | ||
| T-Drive | 9900 | 35.46 | 10.42 | -3.35 | 77.29 | 1.41 | -0.47 |
| 5.04 | 4.92 | -2.29 | 13.45 | 1.51 | +0.53 | ||
| GeoLife | 6200 | 29.15 | 3.62 | -1.52 | 94.25 | 1.51 | -0.56 |
| 2.19 | 4.14 | -2.06 | 3.91 | 2.16 | +1.00 | ||
F.2 Sensitivity to Query Region Size
Building on Section F.1, we next examine how query region size relative to the CountGrid cell size affects estimation accuracy. Using 1,000 fixed query centers following Section 6, we evaluate square queries with side length across the same cell sizes as in Figure F1. For each dataset, we double from half the smallest evaluated cell width until it reaches at least four times the largest cell width. For square CountGrid cells, we define , where ; a query spans approximately cells and a single cell when . We use and as representative points for queries comparable to a single cell and queries spanning several cell widths, respectively.
Figure F2 shows a consistent dependence on query size relative to the CountGrid cell width. The query size nearest to yields lower median Q-error than that nearest to at all evaluated cell sizes on T-Drive and GeoLife, and at seven of eight cell sizes on Porto. At larger , median Q-error increases again for most evaluated cell sizes, particularly at finer resolutions where a query covers many cells; such large queries also fall in the high selectivity range discussed in Section 6.2.
To quantify this pattern, Table F1 compares the evaluated query sizes nearest to and at the coarsest and finest resolutions () for each dataset. At the finest resolutions, median Q-error decreases from 13.66 to 1.92 on Porto, from 4.92 to 1.51 on T-Drive, and from 4.14 to 2.16 on GeoLife; the same improvement occurs at the coarsest resolutions. The median log ratio is negative near at both reported resolutions on all three datasets ( to ), but moves closer to zero near ( to ), showing that the tendency toward underestimation also decreases as queries span several cell widths.
Together with Section F.1, these results show that estimation accuracy depends on relative to both the retained sampling density and the target query sizes. Smaller cells allow a query to span more cells, but can leave insufficient observations within each cell. We next examine the accuracy and resource costs as decreases.
F.3 Grid Cell Size and Synopsis Scalability
We now examine how decreasing the CountGrid cell size affects estimation accuracy and resource cost. To assess whether a sparse storage representation can reduce storage cost without changing the underlying partition, we use a lossless tiled encoding that divides the CountGrid and LabelMap into fixed-size square blocks of adjacent cells, referred to as tiles, and stores sparse or uniform tiles compactly. As in Sections F.1 and F.2, we evaluate cell sizes spanning the same range, using three configurations selected for the target memory budgets and an additional finest setting (). TraHist
382:34
Yujeong Jo, Incheol Baek, Changbeom Shim, and Yon Dohn Chung

(a)
(b)
(c)
Fig. F3. Visualization of CountGrid density field on Porto under varying cell sizes , given in meters. (a) , (b) , (c) . Colors represent log-transformed point counts .
Table F2. CountGrid scalability and lossless tiling across three target memory configurations and an additional finest setting (). (a) reports grid cells (), buckets (), TraHist memory, and construction time. (b) reports median Q-error, CountGrid occupancy, storage reductions after tiling, and query latency overhead.
| Dataset | (m) | (a) Scalability and cost | (b) Accuracy and tiling | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| N | |B| | Mem. (KB) | Const. (s) | Median Q-error | Nonzero (%) | After tiling | ||||||
| Low | Med. | High | (%) | Mem. (%) | Lat. (×) | |||||||
| Porto | 210 | 5,680 | 360 | 50.0 | 20.5 | 4.98 | 1.39 | 2.59 | 75.1 | -0.2 | -0.1 | 2.4 |
| 72 | 48,024 | 7,914 | 498.8 | 26.0 | 1.90 | 2.60 | 5.01 | 56.2 | 16.1 | -0.1 | 2.5 | |
| 38 | 172,480 | 42,645 | 2,014.0 | 27.3 | 1.82 | 3.79 | 5.50 | 43.2 | 28.7 | 4.7 | 2.7 | |
| 397,460 | 118,778 | 4,961.0 | 34.4 | 2.35 | 4.29 | 5.40 | 35.4 | 40.1 | 6.4 | 2.9 | ||
| T-Drive | 9900 | 621 | 30 | 5.3 | 3.9 | 9.45 | 2.36 | 3.78 | 91.9 | -0.5 | -0.4 | 2.3 |
| 3580 | 4,536 | 983 | 50.8 | 4.1 | 6.84 | 1.76 | 1.46 | 66.5 | 2.5 | -0.1 | 2.3 | |
| 1910 | 15,795 | 4,904 | 200.0 | 4.4 | 6.05 | 1.60 | 2.89 | 45.1 | 13.6 | -0.1 | 2.4 | |
| 229,620 | 108,382 | 3,487.0 | 10.6 | 4.68 | 1.46 | 14.98 | 16.0 | 72.9 | 0.0 | 2.8 | ||
| GeoLife | 6200 | 506 | 66 | 5.0 | 4.6 | 6.31 | 1.62 | 2.51 | 73.3 | -0.6 | -0.5 | 2.3 |
| 2110 | 4,160 | 1,109 | 49.8 | 4.7 | 6.17 | 1.61 | 2.81 | 50.4 | 1.1 | -0.1 | 2.4 | |
| 1125 | 14,518 | 5,381 | 197.5 | 4.9 | 5.07 | 1.34 | 3.78 | 36.5 | 34.6 | 0.0 | 2.4 | |
| 1,826,210 | 1,067,362 | 30,945.0 | 39.2 | 2.68 | 1.78 | 2.48 | 6.4 | 88.2 | 0.2 | 3.0 | ||
memory includes the LabelMap and per-bucket statistics, while CountGrid storage is reported separately.
As Figure F3 illustrates, reducing exposes progressively finer spatial structure in the CountGrid density field. The associated scalability cost is quantified in Table F2a, which reports the resulting growth in grid cells, emergent buckets, and memory. On GeoLife, the number of cells grows from 506 to 1.83 million, the emergent bucket count from 66 to over one million, and TraHist memory from 5.0 KB to 30.2 MB; Porto and T-Drive follow the same trend. Construction time grows much more slowly: on GeoLife, it increases from 4.6 to 39.2s despite a roughly increase in cells, and remains within tens of seconds on all three datasets. Thus, memory is the primary scalability cost of decreasing .
The median Q-error columns of Table F2b show that decreasing does not yield consistent accuracy gains. Finer spatial localization benefits low selectivity queries, but at larger query scales, finer cells increase the number of cells and buckets covered by a query, allowing partial-overlap and estimation errors to accumulate. This trade-off varies across datasets: on Porto, decreasing
382:35

(a)
(b) (default)
(c)
Fig. G1. Density-adaptive partitions on Porto under varying contrast balance parameter at a fixed grid cell size . (a) , (b) (default), (c) . Red lines indicate bucket boundaries overlaid on the trajectory data; the number of buckets is 472, 964, and 1,704 in (a)–(c), respectively.
generally improves low-selectivity accuracy while increasing medium- and high-selectivity error; on T-Drive, the finest setting lowers the low-selectivity median Q-error to 4.68 but raises the high-selectivity error to 14.98; and GeoLife shows a more mixed response across selectivity groups. These dataset-specific responses are consistent with the query-size effects in Section F.2 and explain why no single evaluated cell size minimizes median Q-error across all selectivity groups. We therefore select primarily to meet the target memory budget while avoiding cells that are too fine relative to the available sampling density and expected query sizes, as indicated by Sections F.1 and F.2.
We now assess whether the sparse representation reduces storage in practice. Sparse CountGrid tiles store only the positions and values of nonzero cells, while uniform LabelMap tiles store a single label; other tiles remain stored cell by cell. We evaluate tile side lengths of 32, 64, and 128 cells and report 64, the prespecified intermediate size; all three yield the same qualitative conclusions. As decreases, the fraction of nonzero CountGrid cells falls—from 73.3% to 6.4% on GeoLife, for example—and CountGrid storage reductions grow from essentially zero at the coarsest cell sizes to 40.1–88.2% at the finest settings. In contrast, TraHist memory changes by at most 6.4%, because most LabelMap tiles span multiple buckets and the per-bucket statistics are unaffected by tiling. Since query estimation uses the LabelMap and per-bucket statistics rather than the CountGrid, compressing the CountGrid does not materially reduce TraHist memory; the tiled LabelMap representation, however, increases average query latency by 2.3–3.0×. Thus, lossless tiling reduces CountGrid storage at fine cell sizes, but improving TraHist memory scalability requires reducing the number of logical cells rather than only changing their storage representation.
G Parameter Sensitivity Analysis
Having examined the effects of the CountGrid cell size in Section F.3, we now analyze the two parameters governing density-adaptive bucket formation: the contrast balance and threshold scaling . Both operate within the density-adaptive bucket formation process (Algorithm 1), governing how local density contrasts are translated into partition boundaries. We examine how each parameter affects partition granularity and estimation accuracy across datasets and selectivity groups.
G.1 Contrast Balance
The contrast balance parameter controls how local density differences are reflected in density-adaptive propagation (Equation (6)): larger increases sensitivity to fine-grained density
382:36
Yujeong Jo, Incheol Baek, Changbeom Shim, and Yon Dohn Chung

(a) Contrast balance ( fixed)
(b) Threshold scaling ( fixed)
Fig. G2. Estimation accuracy under varying (a) contrast balance and (b) threshold scaling on Porto, T-Drive, and GeoLife. Median, 95th-percentile, and maximum Q-error are reported per selectivity group.
contrast, while smaller favors the smoothed local density field and yields partitions more robust to noise. Figure G1 illustrates this effect on Porto at : as increases, partitions become finer, with growing from 472 at to 1,704 at ; the default yields an intermediate partition ( ).
Figure G2a reports estimation accuracy across at three grid cell sizes on each dataset. Under low and medium selectivity, increasing generally raises median Q-error, with the magnitude growing substantially from Porto to T-Drive to GeoLife. On Porto, the gain from improved density alignment is largely offset by the increase in fragmentation, resulting in only minor variation in median Q-error (e.g., 2.5 to 2.9 at , low selectivity). GeoLife, in contrast, shows a stronger dependence: low selectivity median Q-error grows from 3.8 to 14.7 at as increases from 0 to 1. This reflects its heterogeneous sampling, making smaller more effective for noise suppression. T-Drive falls between these two regimes.
Under high selectivity, the response to becomes more heterogeneous and dataset-dependent. Porto preserves the same direction as the lower selectivity regimes, with Q-error increasing as grows. GeoLife, in contrast, shows the opposite pattern under high selectivity: median Q-error at is consistently lower than at across all evaluated , with the clearest trend appearing
382:37

(a)
(b) (default)
(c)
Fig. G3. Density-adaptive partitions on Porto under varying threshold scaling parameter at a fixed grid cell size . (a) , (b) (default), (c) . Red lines indicate bucket boundaries overlaid on the trajectory data; the number of buckets is 4,380, 964, and 380 in (a)–(c), respectively.
at where it decreases monotonically from 4.1 to 2.1. T-Drive shows a similar but weaker and -dependent reversal: at the coarsest , median Q-error decreases from 2.2 to 1.7, while at finer larger yields higher Q-error (2.1 to 4.1). This behavior reflects the reduced impact of fragmentation under large query regions and the varying degree of density heterogeneity across datasets.
Overall, these observations indicate that primarily controls the granularity of density-adaptive partitioning, while its impact on estimation accuracy depends on the selectivity regime and the density heterogeneity of the dataset. The 95th percentile Q-error follows the median trends under low and medium selectivity but diverges under high selectivity, whereas the maximum Q-error exhibits higher variability across configurations without a consistent trend in . Since low and medium selectivity dominate the challenging workloads emphasized in our main evaluation (Section 6.2), smaller to moderate is generally preferable. The default stays within a small factor of the configuration-wise optimum under low and medium selectivity (typically within in both median and 95th percentile), providing a robust and practical choice.
G.2 Threshold Scaling
The threshold scaling parameter controls the boundary formation criterion of density-adaptive propagation through the adaptive threshold defined in Equation (7). By scaling the local density level, determines the relative contrast required to trigger a boundary: smaller lowers the threshold and promotes finer partitions, while larger suppresses boundary formation and produces coarser partitions. Figure G3 illustrates this effect on Porto at : as increases, partitions transition from highly fragmented to progressively coarser structures, with decreasing from 4,380 at to 380 at ; the default yields a balanced partition with .
Figure G2b summarizes estimation accuracy across at three grid cell sizes on each dataset. Since scales the boundary formation threshold, it directly controls partition granularity, and this structural effect drives an accuracy response that splits sharply by selectivity regimes.
Under low and medium selectivity, increasing improves median Q-error across all three datasets by suppressing excessive fragmentation in sparsely sampled regions, except in Porto’s densest partitioning regime, where partitions are already fine enough that the trend weakens or reverses (e.g., , medium selectivity). The effect is most pronounced on T-Drive and GeoLife, whose trajectory distributions exhibit substantial sparsity: on T-Drive at , low selectivity
382:38
Yujeong Jo, Incheol Baek, Changbeom Shim, and Yon Dohn Chung
Table H1. Q-error on Porto under fixed memory budgets (1000 and 2000 KB), extending Table 2.
| Memory (KB) | Est. | Low (0%, 0.5%] | Medium (0.5%, 2%] | High (2%, 100%] | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 50th | 95th | 99th | Max | 50th | 95th | 99th | Max | 50th | 95th | 99th | Max | ||
| 1000 | MEH | 39.2 | 1249.3 | 5770.1 | 5.9e4 | 5.2 | 175.6 | 457.5 | 1.1e4 | 6.4 | 10.7 | 11.9 | 22.8 |
| MHist | 67.5 | 1297.3 | 2911.3 | 3.5e4 | 7.7 | 222.0 | 805.0 | 6354.2 | 5.5 | 8.5 | 11.8 | 23.2 | |
| LHist | 80.3 | 460.1 | 977.6 | 6.5e4 | 31.2 | 411.2 | 998.6 | 4.6e4 | 2.3 | 9.1 | 34.6 | 74.4 | |
| DEH | 2.5 | ||||||||||||
| CASE+ | 40.7 | 87.8 | 115.1 | 6.5 | 21.3 | 27.1 | |||||||
| TraHist | 1.7 | 5.7 | 15.2 | 401.6 | 1.3e4 | 5.4 | 9.1 | 10.9 | 14.2 | ||||
| 2000 | MEH | 34.0 | 877.8 | 5609.6 | 1.0e5 | 4.9 | 137.1 | 536.4 | 2.1e4 | 6.5 | 10.6 | 12.0 | 23.6 |
| MHist | 51.3 | 919.3 | 2547.2 | 2.5e4 | 6.6 | 160.8 | 456.4 | 4558.9 | 5.8 | 9.2 | 12.1 | 23.6 | |
| LHist | 96.1 | 636.6 | 1381.1 | 1.3e5 | 34.4 | 478.7 | 1163.7 | 8.7e4 | 2.5 | 9.8 | 36.6 | 79.8 | |
| DEH | 2.2 | ||||||||||||
| CASE+ | 36.9 | 86.5 | 103.9 | 392.6 | 5.3 | 20.6 | 24.9 | ||||||
| TraHist | 1.8 | 6.6 | 14.7 | 48.5 | 94.3 | 5.5 | 8.4 | 9.6 | 11.4 | ||||
median Q-error decreases from 35.5 at to 5.2 at , and on GeoLife at , from 23.1 to 3.0 over the same range. On Porto, whose trajectories are more spatially concentrated, the improvement is milder (e.g., from 5.1 to 3.7 at , low selectivity).
Under high selectivity, the response diverges by dataset. On Porto and T-Drive, median Q-error tends to remain stable or decrease as grows, reflecting the reduced impact of fragmentation at large query regions. On GeoLife, in contrast, the direction reverses: coarser partitions induced by larger aggregate heterogeneous density into single buckets, degrading accuracy. At , high selectivity median Q-error rises from 2.4 at to 5.2 at , and analogous increases appear at other . This reversal reflects GeoLife's density distribution, where large buckets span regions with substantial variation.
Overall, controls partition granularity and introduces a dataset-dependent trade-off across selectivity regimes: larger reduces excessive fragmentation and benefits low and medium selectivity across all three datasets, while its effect under high selectivity depends on density heterogeneity—smaller benefits high selectivity accuracy on GeoLife, whereas Porto and T-Drive show the same direction as the lower selectivity regimes, with median Q-error remaining stable or decreasing as increases. The 95th percentile generally follows the median trends under low and medium selectivity but diverges under high selectivity. The maximum Q-error exhibits higher variability without a consistent trend across configurations. The default lies near this trade-off boundary, staying within of the configuration-wise optimum for low and medium selectivity while avoiding the pronounced high selectivity degradation observed on GeoLife at large . This makes a balanced and practical default.
H Extended Results for the Main Evaluation
This appendix extends the budget ranges reported in the main evaluation for Porto and T-Drive. Table H1 and Table H2 extend the accuracy results in Table 2 and Table 3 to 2000 KB and 2000 buckets, respectively, while Table H3 extends the query estimation latency results in Table 4 to the corresponding larger memory and bucket budgets. The overall trends remain consistent with the main evaluation. Under low selectivity, TraHist achieves the lowest median Q-error on both datasets. The advantage continues under medium selectivity on T-Drive, whereas DEH achieves the lowest median Q-error on Porto. Under high selectivity, DEH and CASE+ generally achieve lower error, while the accuracy gap among estimators narrows. The latency result (Table H3) shows
382:39
Table H2. Q-error on T-Drive under fixed bucket budgets (1000 and 2000 buckets), extending Table 3.
| Buckets Est. | Low (0%, 0.5%] | Medium (0.5%, 2%] | High (2%, 100%] | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 50th | 95th | 99th | Max | 50th | 95th | 99th | Max | 50th | 95th | 99th | Max | ||
| 1000 | MEH | 181.3 | 4938.7 | 1.8e4 | 1.8e5 | 24.7 | 792.3 | 1774.0 | 2.6e4 | 14.5 | 29.6 | 31.8 | 32.8 |
| MHist | 649.8 | 2.6e4 | 5.3e4 | 8.7e5 | 84.6 | 5001.8 | 1.2e4 | 1.2e5 | 3.6 | 7.2 | |||
| LHist | 111.9 | 734.6 | 1506.7 | 5365.5 | 52.1 | 610.3 | 1000.6 | 5074.3 | 4.4 | 24.6 | 88.0 | 127.9 | |
| DEH | 231.5 | 659.6 | 765.7 | 851.3 | 57.2 | 160.9 | 190.5 | 230.0 | 3.8 | 11.7 | 19.8 | ||
| CASE+ | |||||||||||||
| TraHist | 6.2 | 13.3 | 33.2 | 162.7 | 1.6 | 13.8 | 33.1 | 48.3 | 18.2 | 33.8 | 69.4 | ||
| 2000 | MEH | 134.3 | 3406.3 | 9573.2 | 1.2e5 | 20.4 | 514.3 | 1366.1 | 1.7e4 | 17.3 | 34.8 | 37.6 | 38.9 |
| MHist | 452.4 | 1.9e4 | 3.7e4 | 5.6e5 | 68.7 | 3598.6 | 7789.6 | 7.9e4 | 4.7 | 8.5 | 9.1 | ||
| LHist | 147.9 | 1056.8 | 2125.6 | 7216.0 | 53.5 | 825.1 | 1402.0 | 6457.2 | 6.2 | 31.5 | 104.2 | 145.2 | |
| DEH | 190.0 | 446.6 | 507.5 | 571.9 | 48.0 | 108.4 | 126.7 | 139.3 | 3.7 | 11.4 | |||
| CASE+ | |||||||||||||
| TraHist | 6.8 | 11.2 | 31.7 | 75.9 | 1.8 | 16.3 | 31.6 | 17.1 | 31.9 | 77.5 | |||
Table H3. Extended query estimation latency (ms) under (a) fixed memory budgets (Porto: 1000 and 2000 KB, T-Drive: 100 and 200 KB) and (b) fixed bucket budgets (1000 and 2000 buckets), extending Table 4. Average and maximum latency are reported over 3,000 trajectory range queries per dataset across all selectivity groups.
(a) Fixed memory budgets
| Memory (KB) | Est. | Porto | T-Drive | ||
|---|---|---|---|---|---|
| Avg | Max | Avg | Max | ||
| 1000 / 100 | MEH | 2.173 | 5.501 | 0.676 | 1.820 |
| MHist | 277.641 | 357.605 | 55.265 | 62.270 | |
| LHist | 3.834 | 9.132 | 1.653 | 3.496 | |
| DEH | 0.547 | 0.564 | 0.537 | 0.557 | |
| CASE+ | 0.560 | 0.586 | 0.548 | 0.582 | |
| TraHist | 0.591 | 0.623 | 0.577 | 0.593 | |
| 2000 / 200 | MEH | 3.902 | 10.035 | 1.337 | 3.680 |
| MHist | 705.594 | 745.284 | 39.958 | 40.621 | |
| LHist | 5.369 | 13.068 | 2.114 | 4.713 | |
| DEH | 0.542 | 0.571 | 0.538 | 0.557 | |
| CASE+ | 0.555 | 0.587 | 0.550 | 0.580 | |
| TraHist | 0.588 | 0.633 | 0.574 | 0.590 | |
(b) Fixed bucket budgets
| Buckets Est. | Porto | T-Drive | ||
|---|---|---|---|---|
| Avg | Max | Avg | Max | |
| MEH | 0.265 | 0.570 | 0.343 | 0.899 |
| MHist | 19.379 | 19.387 | 18.893 | 18.981 |
| LHist | 9.823 | 24.557 | 10.758 | 27.064 |
| DEH | 0.538 | 0.557 | 0.541 | 0.559 |
| CASE+ | 0.554 | 0.580 | 0.550 | 0.582 |
| TraHist | 0.566 | 0.575 | 0.567 | 0.583 |
| MEH | 0.246 | 0.552 | 0.617 | 1.663 |
| MHist | 16.181 | 16.338 | 33.862 | 33.955 |
| LHist | 18.433 | 46.737 | 20.018 | 50.996 |
| DEH | 0.540 | 0.559 | 0.542 | 0.559 |
| CASE+ | 0.556 | 0.586 | 0.555 | 0.582 |
| TraHist | 0.577 | 0.593 | 0.565 | 0.580 |
the same efficiency trends as in the main evaluation: DEH, CASE+, and TraHist maintain stable sub-millisecond latency, while MHist and LHist become substantially slower as the budgets increase, with latency reaching up to three orders of magnitude higher.
Received 17 April 2026; revised 19 August 2026; accepted 12 September 2026