PHP and MySQL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kurisu
    New Member
    • Oct 2007
    • 1

    #1

    PHP and MySQL

    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.
  • jx2
    New Member
    • Feb 2007
    • 228

    #2
    wow you've got quite a problem
    i thing that javascript and ajax would do the job done

    look here for more info about AJAX

    but honestly 5 -10 minuts thats very long you have to do something about it
    100milions records thats a lot but 10 minutes!! :-)

    good luck
    jx2

    Comment

    • w0rKInPHP
      New Member
      • Oct 2007
      • 6

      #3
      I would use ajax for that. You can even ajax two different files, one with a setTimeout() that will time the query and the other with be the actual query. When the ajax responds you just use the same div field with innerHTML so that you can display the option of using a different search method before the query is finished and when the query finishes, you just override the innerHTML with the query results.

      Otherwise this is going to be a tough thing to do without JS.

      Comment

      Working...