SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard
    Join Date
    Oct 2004
    Newport Beach
    0 Post(s)
    0 Thread(s)

    Run MySQL Update Query from Remote Script?

    As I've said in a number of previous threads, I'm trying to figure out the best way to handle what to do with my 1 million-plus update queries that my site needs to run every day.

    The UPDATE queries are slowing my site down, due to locking the table, so I'm thinking of having all updates going to a single table meant just for those. However, I do have some questions.

    First, if I have an UPDATE query on one of my pages, will that page not load until that UPDATE query runs successfully? Or is the UPDATE query just sent to the MySQL server and the rest of the PHP script on the page is processed. My concern is whether the page waits for some sort of completion response on the query itself before moving on.

    If it does in fact have to wait for the UPDATE query to complete, is there a way I can run this query from an external php script with the same UPDATE query in place?

    Any information appreciated.

    Upcoming Movies - Movie News. Updated Daily.
    Movie Trailers - Awesome trailer site. Nuff said.

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Philadephia, PA
    1 Post(s)
    0 Thread(s)
    Yes, the script will wait for the query to execute.

    Yes, you can decouple the query from the script if you don't need it to happen before displaying the page.

    Shuffle off all those queries into a buffer somewhere (an in-memory database, or append to a text file) and have a separate process run the unexecuted queries in batches.

    Though, I'd hold off on engineering all this until you're sure you need it. I'll reply in your other thread about the database stuff. You can probably resolve the locking issue and not worry about saving a few milliseconds by decoupling this stuff.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts