Q3C (Quad Tree Cube) enables fast cone, ellipse and polygonal searches and cross-matches between large astronomical catalogs inside a PostgreSQL database. The package supports searches even if objects have proper motions.
https://ui.adsabs.harvard.edu/abs/2006ASPC..351..735K