Hi all.
I've been going crazy trying to think of a solution for the following problem:
I have a database that holds over a hundred million records. I've optimized the database and code so that user queries have a relatively quick turn around. Unfortunately, the occasional user will enter search criteria that could take 5-10 minutes (or even longer) to return results. I'd like to be able to identify these queries with a timer, so after 15 seconds I can alert the user that their query will take some time-do they wish to continue.
Is there anyway that I can monitor the database query and alert the user after XX seconds and without killing the query in the process?
I haven't worked with PHP in a while and am trying to come up to speed with what it can do. I've read about it's pcntl_xxx functions, fork(), page timers and even tried using Ajax timers. The trouble with the timers is that it appears to be page specific.
I thought that fork() or the pcntl_xxx function might a route to take, but I'm not sure how well these functions would integrate with a web environment, what is involved in transferring the data from child to parent, etc.
I have also looked into scrapping the database and using an indexer like Sphinx, but the powers-that-be want to first try and see if we could get things working without going that route.
Any help would be appreciated.
Thanks.
I've been going crazy trying to think of a solution for the following problem:
I have a database that holds over a hundred million records. I've optimized the database and code so that user queries have a relatively quick turn around. Unfortunately, the occasional user will enter search criteria that could take 5-10 minutes (or even longer) to return results. I'd like to be able to identify these queries with a timer, so after 15 seconds I can alert the user that their query will take some time-do they wish to continue.
Is there anyway that I can monitor the database query and alert the user after XX seconds and without killing the query in the process?
I haven't worked with PHP in a while and am trying to come up to speed with what it can do. I've read about it's pcntl_xxx functions, fork(), page timers and even tried using Ajax timers. The trouble with the timers is that it appears to be page specific.
I thought that fork() or the pcntl_xxx function might a route to take, but I'm not sure how well these functions would integrate with a web environment, what is involved in transferring the data from child to parent, etc.
I have also looked into scrapping the database and using an indexer like Sphinx, but the powers-that-be want to first try and see if we could get things working without going that route.
Any help would be appreciated.
Thanks.
Comment