When doing update queries what is the best way to have it do it in steps where it won't time out? And is there a number which isusually commonly used for a cutoff point?
Should I have the php counting as it does each update and when it gets to that number then have it redirect and then have something in the url where it knows where to start again? Is that what people normally do? Or maybe change some extra field in the DB from 0 to 1 and then it simply start the process again where the field=0 ?
I'm sure I can figure out some ways, but just curious how people normally handle this and what a good number would be which would be likely to be fine.
Doing Things In Steps
Started by BASHERS33, Apr 21 2009 12:54 AM
5 replies to this topic
#1
Posted 21 April 2009 - 12:54 AM
|
|
|
#2
Posted 21 April 2009 - 02:08 AM
are you talking of doing alot of updates after each other?
are you talking about updating the views-counter on a forum thread? then I'd update it on the fly in the database. it's merely once for a page load.
are you talking about updating the views-counter on a forum thread? then I'd update it on the fly in the database. it's merely once for a page load.
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall
I study Information Systems at Karlstad University when I'm not on CodeCall
#3
Posted 21 April 2009 - 04:57 AM
For thigns similar to views counters I'm not worried, but for a betting program I made it updates the rows of the winners so there could be hundreds or thousands of winners if it were used on a busy site some time in the future. So that's why I figured I better break it up since I am trying to be sure it would be ok for a busy site (if I ever even decide to sell it).
#4
Posted 21 April 2009 - 09:04 AM
For betting programs etc, i'd run backend scripts dealing with that.
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall
I study Information Systems at Karlstad University when I'm not on CodeCall
#5
Guest_Jordan_*
Posted 21 April 2009 - 01:24 PM
Guest_Jordan_*
I agree with Orjan. Backend on some kind of time interval so that it doesn't kill the database if thousands of users suddenly visit.
#6
Posted 21 April 2009 - 03:03 PM
Well this is a modification for Invision's forum software, so I could make it a task and only have x rows updated and then it would be a while before it would update the next 50, etc...
But I;ve really got to look on my couple programs and see how often there "could" be a time where a lot of rows will be updated. It won't be so great to have it do it in the background over an extended period of time especially since some of the times it's dependant on a value in the url or hidden input, I could change it to where it doesn't, but without looking I am having a hunch that it wouldn't be so quick and it wouldn't be ideal to have some rows updated and some not.
The way the forum software itself usually does this is it will do X number of updates, then it will do a redirect screen which causes a brief pause, then it updates the next batch and it keeps doing that until it's finished. That was what I was hoping I could do. But even that way I "may" have to add fields to the DB to be sure which rows haven't already been updated. Not sure until I take a look.
But I;ve really got to look on my couple programs and see how often there "could" be a time where a lot of rows will be updated. It won't be so great to have it do it in the background over an extended period of time especially since some of the times it's dependant on a value in the url or hidden input, I could change it to where it doesn't, but without looking I am having a hunch that it wouldn't be so quick and it wouldn't be ideal to have some rows updated and some not.
The way the forum software itself usually does this is it will do X number of updates, then it will do a redirect screen which causes a brief pause, then it updates the next batch and it keeps doing that until it's finished. That was what I was hoping I could do. But even that way I "may" have to add fields to the DB to be sure which rows haven't already been updated. Not sure until I take a look.


Sign In
Create Account


Back to top









