What analysis are you performing which causes you to conclude that nothing
is being delayed? I'd probably check this by creating an insert...select
which takes at least a few seconds to execute, and then have my test
application log the time, make the call to MySQL, and log the time again. I
suppose you could probably do something with locking instead of making the
insert slow, but I'm never very confident that the database won't secretly
execute my statement and delay exposing the altered table to the locking
thread until it unlocks. (I'm pretty sure MySQL won't do this, but I'm
superstitious.)

The online docs for DELAYED do seem a bit confusing. I don't think of
DELAYED in terms of its interaction with other threads-- I think MySQL
actually still provides the guarantee that SQL statements will be executed
in order, although some of the docs here appear to contradict that.
My view on DELAYED is that it does nothing more than make the call to the
database asynchronous. Instead of calling MySQL, waiting for your statement
to execute, and returning, executing a DELAYED statement results in calling
MySQL, returning, and letting the statement execute asynchronously with your
own thread. Although the async call happens on the server side of the
connection, you can get a pretty much equivalent effect by simply spawning a
new thread (with its own independent connection to MySQL) and letting it
send your statement for you. Clearly, this wouldn't necessarily affect the
order of execution of SQL statements in the server at all; it just lets you
get on with your other work while the server is working.

-Rob

PS: No pedantic comments about locking, synchronization, and connection
ordering with respect to thread-spawning, please; it was just an example.

On 29/4/02 at 2:11 pm, Emery Lapinski <[EMAIL PROTECTED]> wrote:

> Hello,
> 
> I'm trying to use the DELAYED keyword with an INSERT ... SELECT
> statement but it seems to ignore the DELAYED. Does anyone know if this
> is or is not supposed to work? Exmple:
> 
> session 1                       session 2
> ------------------------------- --------------------------------------
> create table junk (value int);
> create table junk2 (value int);
> lock table junk read;
>                                 insert into junk2 values (1);
>                                 insert delayed into junk values (2);
>                                 insert delayed into junk select value
>                                    from junk2;
> unlock tables;
> 
> http://www.mysql.com/doc/I/N/INSERT_SELECT.html
> http://www.mysql.com/doc/I/N/INSERT_DELAYED.html
> 
> Thanks,
> Emery


---------------------------------------------------------------------
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