Locking for data integrity

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

 



I'm making a query to one table, and inserting it into another table
(INSERT.SELECT syntax). The table that's the source of the copy is
updated constantly, and is has a large amount of data in it. Will
locking the table for write (or read??) access keep insert queries to
the source table from executing at all, or will they be queued, and
executed after the lock is lifted? The MySQL manual wasn't clear on
this.

I may be misunderstanding the SQL meaning of "locking" something; I want
to keep a table from being updated while I'm getting information from
it, but I still want the inserts to be executed after I'm finished with
the table. I'm running the query in a cron job daily to "compress" the
data in a log table, and keep it from growing out of control, by copying
the totals per user from the live table into a daily table, and then
deleting all of the records in the live table. If the live table is
locked and the inserts made during the lock are queued and executed
after the lock is released, it makes the whole thing a lot easier to
manage. I can empty the live table and be sure that all of the data in
the live table the following day is new data, and not worry about data
loss because of the execution time of the script (which could be as long
as 30 seconds or more, we've gotten over 17,500 unique entries in the
past 24 hours, and the site is growing).

Thanks for your help.

-- Josh


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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux