is it possible to decrement a value inside a table every seconed or day or whatever?

if it's in the wrong section i'm sorry.

7 Years
Discussion Span
Last Post by EricIskhakov

This would be a task for a cron job.
MySQL has date/time functions, so you could write a trigger which checks and updates a time value on every operation (update,insert,delete), but it would not do anything without such an operation.
You could also code something like

select unix_timestamp('2012-01-01') - unix_timestamp(now()) as countdown;

ok then let me ask you another question,if 20,000 pepole load a page that refreshes itself every second, how affecting is it on server performance?
(a 5 kb page )


Ok, let me answer: the server load will be 20.000 pages per second. And with a 5 kb page it will be 100.000 kb per second.
Is this much or not? It all depends how the pages are constructed and delivered. Can you use a cache? Can you use the MySQL cache for repeated queries? And so on.
Apart from that, it seems to me like a silly idea to have a database pose as a countdown timer. Maybe you'd better tell us more about your problem, because this thread here gets somewhat misleading.


Ya this is irelivent now.
i came out really stupid.
i wanted to save a number of seconed left for a count down time and decrease it every seconed.
then i realised its a "silly idea" and just saved a timestamp and at the countdown i only compare the time at the moment with the time set in the timestamp and show the time left.
thanks for your help though!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.