Use the MIN aggregation function for cert-checker's start-of-window (#5406)
Use the MIN aggregation function for cert-checker's start-of-window (#5406)

Switch from using `ORDER BY` and `LIMIT` to obtain a minimum ID from the
certificates table, to using the `MIN()` aggregation function.

Relational databases are most optimized for set aggregation functions,
and anywhere that aggregations can be used for `SELECT` queries tends to
bring performance improvements. Experimentally this is an
order-of-magnitude improvement in query time. Theoretically the query
optimizer should have constructed the same underlying query from each,
but it didn't.

Partially reverts #5400
Fixes of #5393
letsencrypt/boulder,letsencrypt/boulder,jsha/boulder,jsha/boulder,jcjones/boulder,letsencrypt/boulder,jsha/boulder,jcjones/boulder,jcjones/boulder,jcjones/boulder