Thinking Relational: Using SQL for spatial data access the way god
intended-- it's sets stupid!
Spatial objects, temporal objects, or in fact subspaces in any metric
space can be described by constraints that define the union of convex
hulls (and their negations). These objects have a disjunctive normal
form representation and obey DeMorgan's Laws under Boolean operations.
They can be represented by a pair of relations that allow very
efficient object manipulation and very simple containment queries. The
SQL programs are short, simple, and execute quickly, mostly because
SQL is a set-oriented programming language. A related but different
problem is computing all neighbors of a point set. This computation
runs slowly if programmed as a loop outside SQL; but, when expressed
as set manipulations runs two orders of magnitude faster. The
take-away from this is that there are real incentives for using SQL as
a set-manipulation language rather than a record-at-a-time access
method.
(This work is joint with Alex Szalay of Johns Hopkins University.)