I’m working with a logfile that records data every 10 minutes. I’m trying to come up with a query that can verify that data was in fact saved every 10 minutes.
Here are some sample timestamps:
2008-01-01 00:00:00
2008-01-01 00:10:00
2008-01-01 00:20:00
2008-01-01 00:30:00
Any ideas on this? I’d give some SQL if I thought it could be improved to be correct but I don’t have anything worth posting.
One trick is to make a virtual table to which you can attempt to join the the data from your logfile. In my example I’ve used the postgres generate_series function to generate a series of second values to append to an initial timestamp (I assume there is a similar function in MySQL?).
The trick is to use the virtual table to which to do a left join to the actual data, to find where there is a missing value in the logging table (i.e., where logger.timestamp will be NULL).
Something along these lines will show you where there is a missing timestamp if any.