2 Replies Latest reply on Aug 3, 2011 5:52 PM by brandon_05mn

    How to update database once every night automatically?

    brandon_05mn Level 1

      Hi everyone,

       

      Situation: I have a online game (similar to yahtzee) website that keeps stats for all users. Every time the web page is loaded, stats are loaded via SQL from the database (think high scores, average score) and displayed on the screen.

       

      For now, this works fine. But what happens if I get more complicated quieries, or many many games. The queries would take a long time. Could I have the quieries executed nightly? Then when the webpage is loaded for the users, they could just reference the nightly update (either file, or condensed rules table)?

       

      Question: Is there a way I can have all of my 'all games' queries be executed automatically every night? If there are 10000+ games, the average score really wouldn't change much from game to game. If it was just updated every night, that would be good enough. 

      I know I could write an event listener to check the system date, and if it is a new day, (midnight) perform the quieries. But that would only work IF the website is open. How can I have this process work 100% of the time? Do I have to have something else set up on the server in order to get something like this to work?

       

      Thanks!

       

      - Oh, and if you want to check out my website and see what I am talking about... check it out

      www.yahtzo.com