I have a daemon which uses MySQL (INSERT INTO) to log. The problem is,
whenever I try to do anything with the log table that takes a long
time, it makes the daemon freeze until the table is free again.

I'm thinking of making the daemon use INSERT DELAYED instead, so that
it won't get blocked. But, each log entry requires inserting data into
table1 AND table2 (for each entry in table1, there are multiple
entries in table2).

INSERT INTO table1 SET id = NULL, ...;
$id = SELECT LAST_INSERT_ID();
INSERT INTO table2 SET id = $id, ...;
INSERT INTO table2 SET id = $id, ...;
INSERT INTO table2 SET id = $id, ...;

If I use INSERT DELAYED, then the LAST_INSERT_ID() isn't going to
work, right?

How can I make the daemon avoid blocking, yet still be able to insert
data into both tables? Should I perhaps make my daemon generate its
own ids (rather than relying on AUTO_INCREMENT), and then use INSERT
DELAYED for everything?

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to