mysql - Reliably select from a database table at fixed time intervals -


i have 'active' cdr table want select records every 5 minutes last 5 minutes. problem has sha ids generated on few of other columns have lean on timestamp field filter date select time window of records want.

the next problem cannot guarantee script run on second precisely every time, or wall clocks of server correct (which doesn't matter) , importantly there more 1 record per second 3 rows '2013-08-08 14:57:05' , before second expired 1 more might inserted.

by time '2013-08-08 14:57:05' , records between '2013-08-08 14:57:05' , '2013-08-08 15:02:05' there more records '2013-08-08 14:57:05' have missed.

essentially:

  • imprecise wall clock time
  • no sequential ids
  • multiple records per second
  • query execution time
  • unreliable frequency of running query

are preventing me getting valid set of rows in specified rolling time window. suggestions how can go around these?

if using same clock see no reason why things wrong. resolution want consider datetime table. way, every time updated start , stop times based on server time.... things added guarenteed within timeframe.

i mean, hardcoding, way sort of forcibly store start , stop point in database use.

i use cron handle intervals , timing somewhat. not use time that, not lock database checking time.


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

jquery - How would i go about shortening this code? And to cancel the previous click on click of new section? -