#1
  1. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    2,670
    Rep Power
    171

    What goes on in the database when an UPDATE query (small or big) is in progress?


    About accessing Mysql database via web applications (websites or phpmyadmin) which one is true:

    1. When an update query is in progress, data cannot be updated or retrieved from that table until the UPDATE is finished.
    2. When an update query is in progress, data cannot be updated but can be retrieved from that table until the UPDATE is finished.
    3. When an update query is in progress, data can be both update and retrieved from that table, the UPDATE has nothing to do with it.
    4. Any of the above could happen based on the way the query is written.
    5. When an update query is in progress, the table gets locked and any application trying to access that table freezes.
    6. None of the above is true (Please write what really happens).
  2. #2
  3. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,317
    Rep Power
    7170
    The answer to this question is actually very complicated as there are a huge number of factors that affect this behavior.

    Whether or not the entire table is locked, and how data can be retrieved from the table during an update depends on at least:
    * What database engine the table uses
    * Whether any LOCK statements have been issued
    * Whether the updater is in a transaction
    * If the updater is in a transaction, what the transaction's isolation level is
    * Whether the reader is in a transaction
    * If the reader is in a transaction, what the transaction's isolation level is
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

IMN logo majestic logo threadwatch logo seochat tools logo