The Metabase instance this post originally pointed at is retired. The data behind it is public, so the queries below still run anywhere you can put the JPL Small-Body Database in front of SQL, and the links at the end go to NASA’s own tools.

I had loaded roughly 1.5 million small-body records into a database and put Metabase in front of it. Below is what was in there and the queries that made it worth the setup.

What is actually in there

The bulk of the row count is the JPL Small-Body Database: numbered and provisional asteroids and comets, each with its osculating orbital elements at a reference epoch. Semi-major axis, eccentricity, inclination, longitude of the ascending node, argument of perihelion and mean anomaly, plus the physical parameters where anyone has measured them, which for most objects means absolute magnitude and nothing else.

Alongside that sit the derived tables that make the whole thing worth querying: close approaches, the Sentry impact-risk listings, and the NHATS set of objects that are plausible crewed-mission targets. Those are the ones with interesting joins in them.

Why a SQL front end and not a notebook

Because most of the questions I actually have are one join and a filter, and writing a notebook cell for those is friction. Metabase sat on the database and gave you a query builder for the easy ones, raw SQL for the rest, and saved questions you could pin to a dashboard. Something like:

select   full_name, diameter, moid, first_obs
from     sbdb
where    neo = true
  and    pha = true
  and    diameter > 0.5
order by moid asc
limit    50;

That’s potentially hazardous asteroids over 500 metres, sorted by how close their orbit comes to Earth’s. The moid column is the minimum orbit intersection distance, and it does most of the work in this dataset: it is a property of the two orbits rather than of any particular pass, so it tells you what is geometrically possible rather than what is scheduled.

The joins are where it stops being a lookup table. Close approaches live in their own rows, one per pass, so pulling the next decade of them against the element set is a single statement:

select   s.full_name, s.diameter, c.cd, c.dist, c.v_rel
from     close_approach c
join     sbdb s on s.des = c.des
where    c.cd between '2026-01-01' and '2036-01-01'
  and    c.dist < 0.05
order by c.dist asc;

dist is in astronomical units, so 0.05 is about twenty times the distance to the Moon. Against moid the difference is the point: one tells you the orbits can come that close, the other tells you a specific date on which they do.

The indexing matters more than anything clever. Plain B-tree indexes on the flags, on moid and on the designation used for the joins, and the 1.5 million rows come back fast enough that you keep asking questions instead of going for coffee.

Getting the same data now

NASA publishes all of it directly, and it is the same source the instance was built from. The SBDB Query Tool runs filtered element searches in the browser. CNEOS hosts the close-approach, Sentry and NHATS listings. If you would rather build your own copy, the SBDB API returns the same records as JSON.