In the context of databases storing histories of movement (also called trajectories), we present two query processing operators
to compute the k nearest neighbors of a moving query point within a set of moving points. Data moving points are represented as collections
of point units (i.e., a time interval together with a linear movement function). The first operator, knearest, processes a stream of units arriving ordered by start time and returns the set of units representing the k nearest neighbors over time. It can be used to process a set of moving point candidates selected by other conditions. The
second operator, knearestfilter, operates on a set of units indexed in an R-tree and uses some novel pruning techniques. It returns a set of candidates that
can be further processed by knearest to obtain the final answer. These nearest neighbor algorithms are presented within Secondo, a complete DBMS environment for handling moving object histories. For example, candidates and final results can be visualized
and animated at the user interface.