slow select query on datetime column
Here's one attempt:

SELECT MIN(created_at), MAX(created_at) 
FROM (
    SELECT created_at
    FROM runs 
    ORDER BY id DESC 
    LIMIT 10000
) as x;


Your query is evaluated as:

SELECT MIN(created_at), MAX(created_at) FROM runs


Then it is ordered according to id (which doesn't make sense) and a maximum of 10000 rows is returned (only 1 row exists)

My query first picks the 10000 most recent id's

SELECT created_at
FROM runs 
ORDER BY id DESC 
LIMIT 10000


From there it picks min and max for created_at