January 4, 2019
Pretty frequently at work, I end up polling a database with some command like
SELECT MAX(id) FROM my_tbl; SELECT MAX(id) FROM my_tbl; SELECT MAX(id) FROM my_tbl; SELECT MAX(id) FROM my_tbl; -- .... ad nauseam .... I’ve eventually noticed a few patterns I use pretty consistently:
estimate ETA by including NOW()/UNIX_TIMESTAMP() Generally, the point of hovering over the table is to get an estimate of when it will finish/catch up/whatever. For that, you generally want to include a timestamp in the query output, so when you come back a while later, you can know exactly how much time has elapsed.