php - Update records once a year, spread evenly throughout year -
Not the best way to make sure what I'm trying to do, bear with me I Working with PHP with MySQL database
I have a database of 10,000 records, suppose I want to update 10000/365 per day throughout the year. Each record gets updated 1x per year, and spreads well throughout the year.
An easy way to do this is to choose all the records, for each, if ID% 365 = $ day_of_year, then update that record. I'm not worried about leap year.
Is there any way that I can select records from the database rather than selecting all databases and looping through each (approximately 27)? This is a cron job that I will run in the middle of the night, so perhaps this is an important issue. Even then, it bugs me that I have to force my power through 10,000 rupees, it would be nice to find a more beautiful solution by dragging only a small fraction.
add a column
then add that event once a year Moves and reset the values of that column and it is counted in new form - 10000 records of the year are spread out.
Then add another event that runs every night to update the record for the day.
Comments
Post a Comment