Maintenance of K -nn and spatial join queries on continuously moving points

Glenn S. Iwerks, Hanan Samet, Kenny SmithACM Transactions on Database Systems 2006 · DOI

TL;DR

This paper tackles the challenge of efficiently maintaining real-time spatial queries (k-nearest neighbors and spatial joins) on continuously moving objects. It introduces novel event-driven algorithms that dynamically adjust to changes in object locations and database updates, outperforming previous methods by orders of magnitude in experimental tests.

What Problem Does This Paper Address?

In today's world, many objects are constantly on the move – think of cell phones, vehicles, or aircraft. Databases need to keep track of these moving objects to answer queries like "who is closest to me?" or "which objects are within range of each other?". The challenge is that these objects' locations change continuously, and their movement patterns can change unexpectedly (e.g., a car changing lanes or an aircraft altering its course). Traditional databases struggle with this because they typically store static snapshots of data. This paper addresses the problem of efficiently maintaining the results of spatial queries (specifically k-nearest neighbor and spatial join queries) on these continuously moving objects, even when their movement patterns change and the database itself is updated. The key difficulty is that query results can change solely due to the objects' movement, independent of any database updates.

Methods

The paper's core contribution lies in its event-driven query maintenance algorithms. Instead of constantly re-evaluating queries, these algorithms predict when a query result might become invalid and only react when those predicted "events" occur.

  • Kinematic Representation: Objects are represented not by their current location, but by a function describing their position over time (e.g., p(t) = x₀ + (t - t₀)v). This allows for efficient updates when an object's course or speed changes.
  • Event Types:
    • Within Events (w-events): Occur when a moving object enters or exits a specified distance from a query point.
  • Order Change Events (oc-events): Occur when the relative order of objects with respect to a query point changes. A special case is the nearest neighbor event (nn-event), which signals a change in the k-nearest neighbor.
  • Algorithms:
    • iCW (Improved Continuous Windowing): For k-NN queries, this algorithm uses a dynamically resizing circular window around the query point. It filters candidate points and efficiently maintains the k-NN result by processing w-events and nn-events. It's an improvement over previous CW algorithms by supporting query point updates and dynamic window resizing to avoid underflow.
  • ETP (Extended TP): Also for k-NN, this algorithm builds upon existing work and uses a TPR-tree index to efficiently find nearest neighbors and predict the next nn-event. It's designed to handle updates to both data points and the query point.
  • AE (All Events) and NE (Next Event): For spatial join queries, these algorithms manage events in a priority queue. AE enqueues all future events within an "event generation cycle," while NE only enqueues the very next event for each relevant object. This difference impacts queue size and processing overhead.

The algorithms are designed to handle updates to the underlying data (insertions/deletions of moving objects) and to the query point itself, without requiring prior knowledge of these updates.

Datasets

The authors evaluated their algorithms using two types of datasets:

  • Synthetic Uniformly Distributed Data: Generated using a tool by Saltenis et al. [2000], these datasets featured moving points distributed uniformly over a 1000x1000 coordinate space. Speeds were also uniformly distributed.
  • Real Aircraft Flight Data: This data was derived from actual flight trajectories. Latitude-longitude data was converted to linear functions of motion, and the Douglas-Peucker algorithm was used for simplification. This data is characterized by clustering and varying flight patterns.

Key Insights and Ideas

  • Event-driven processing is crucial: For continuously moving objects, predicting and reacting to specific "events" (like entering a query radius or changing relative order) is far more efficient than constant re-computation.
  • Dynamic window resizing is key for k-NN: The iCW algorithm's ability to dynamically adjust its query window size is critical. A fixed, large window can lead to excessive event processing, while a window that's too small can underflow, requiring costly rescans. Dynamic resizing strikes a balance.
  • The cost of updates is significant: Updating the underlying data structures (like TPR-trees) for every change in object position or query point location is a major performance bottleneck. Algorithms that minimize these updates or amortize their cost are more efficient.
  • Trade-offs in spatial join event management: The AE vs. NE algorithms highlight a fundamental trade-off: AE's larger event queue might be more efficient for short event cycles, while NE's smaller queue and reliance on index lookups might be better for longer cycles.

Key Results

The experimental results demonstrate the significant advantages of the proposed event-driven algorithms:

  • iCW vs. ETP (k-NN): The iCW algorithm outperformed the ETP algorithm by over an order of magnitude in terms of disk accesses for both aircraft and uniform data. This was attributed to iCW's dynamic window resizing and more efficient event queue management.
  • AE/NE vs. Naive CSJ Adaptation (Spatial Join): The AE and NE algorithms outperformed a naive adaptation of the continuous spatial join (CSJ) algorithm by nearly two orders of magnitude.
  • Performance with Updates: The iCW algorithm showed relatively constant performance as the average update interval (UI) increased, whereas ETP's performance degraded quadratically as UI decreased.
  • Impact of Data Size: Disk accesses generally scaled with data set size, but the iCW algorithm consistently showed significantly fewer accesses than ETP.
  • No Updates Scenario: Even when there were no updates, ETP was more efficient than iCW, but the difference was less dramatic than in scenarios with updates.

Limitations and Future Work

  • Implementation Issues: The authors acknowledge that implementation details can affect performance, and their experiments were run on specific hardware and software configurations.
  • Update Efficiency: While their algorithms handle updates, the cost of updating underlying data structures (like TPR-trees) remains a challenge. Future work could focus on developing more update-efficient indexing structures.
  • Handling Erratic Motion: The current kinematic model assumes predictable linear motion. While updates can change parameters, highly erratic or unpredictable motion might require different modeling approaches.
  • Scalability of AE/NE: The paper notes that the AE algorithm's large event queue can become a bottleneck, and further research into optimizing queue management and index usage is suggested.
  • Future Work: The authors suggest exploring more update-efficient data structures, improving methods for handling changes in velocity, and investigating other spatial indexing structures like STAR-trees.

Summary updated

Abstract

Cars, aircraft, mobile cell phones, ships, tanks, and mobile robots all have the common property that they are moving objects. A kinematic representation can be used to describe the location of these objects as a function of time. For example, a moving point can be represented by the function p ( t ) = x → 0 + ( t - t 0 ) v → , where x → 0 is the start location, t 0 is the start time, and v → is its velocity vector. Instead of storing the location of the object at a given time in a database, the coefficients of the function are stored. When an object's behavior changes enough so that the function describing its location is no longer accurate, the function coefficients for the object are updated. Because the location of each object is represented as a function of time, spatial query results can change even when no transactions update the database. We present efficient algorithms to maintain k -nearest neighbor, and spatial join queries in this domain as time advances and updates occur. We assume no previous knowledge of what the updates will be before they occur. We experimentally compare these new algorithms with more straight forward adaptations of previous work to support updates. Experiments are conducted using synthetic uniformly distributed data, and real aircraft flight data. The primary metric of comparison is the number of I/O disk accesses needed to maintain the query results and the supporting data structures.
BibTeX
@article{iwerks2006maintenance,
  author = {Glenn S. Iwerks and Hanan Samet and Kenny Smith},
  title = {{Maintenance of <i>K</i> -nn and spatial join queries on continuously moving points}},
  journal = {ACM Transactions on Database Systems},
  year = {2006},
  doi = {10.1145/1138394.1138396},
}
Figure