Re: Lots of queries!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Philip Thompson wrote:
> Hi all.
> 
> I have a list of people in a database who live in particular rooms. Next

lucky them, back when I was a kid you were lucky if you had a cardboard box,
and a wet one at that.... ok let's not go down that road ;-)

> semester, they may live somewhere else, so I need to update my database.
> (I know the data becomes stale, but not that often.) Here's what I'm
> doing to update:
> 
> 1. Pull list of IDs from database A - store in array
> 2. Foreach ID in array, search database B to see if they have a new room
>   2a. If no, go back to step 2 and go to next ID
> 3. Compare new room to current room
>   3a. If different, update the record to new room
> 
> That's basically it. Now, I know this works (sorta) because the records
> are updating with the appropriate information. Here's the problem I'm
> running into: it only does a certain amount and then quits!! WHY!!?!

your script is timing out. search this lists archive, the web and the manual
for more info.

AND THEN ... assuming your script is not fundamentally flawed (i.e there is not a way
you could do what you want much faster and with *way* less queries) ...

go make your update script to work as a cmdline script (so it works from the cmdline
rather than being called from the browser);

basically it sounds like what you want to do could more suitably considered
as 'offline' processing - something you shouldn't be triggering from a http request.
(cmdline scripts don't timeout by default, where as scripts run via http do -
you can force scripts run via http to keep going but if you need to do that there is
something wrong - any script run via web request should finish in a few seconds at most)

> 
> The total number of records I have is 1335 - pulled from step 1.
> However, when I go through the list and query for new rooms, it stops...
> randomly... not even at the same record each time. Sometime it's 230,
> sometimes it's 476 - truly random from what I can tell. I am sorting the
> query (ORDER BY) each time, so I know it's the same order.
> 
> Any thoughts on why this is happening? Possibly a buffer issue?
> 
> Thanks in advance.
> ~Philip
> 
> --PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux