List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:November 9 1999 10:34pm
Subject:Delayed_insert - Waiting on cond
View as plain text  
>>>>> "Bill" == Bill Marrs <bill@stripped> writes:

Hi!

Bill> I'm fairly confident that this is normal, but I seem to always have a 
Bill> couple Delayed_inserts in my mysql process queue (despite the server having 
Bill> no load otherwise):

Bill> % mysqladmin proc
Bill> +----+------+-----------+------+----------------+------+-----------------+-- 
Bill> ---+
Bill> | Id | User | Host      | db   | Command        | Time | State           | 
Bill> Info     |
Bill> +----+------+-----------+------+----------------+------+-----------------+-- 
Bill> ---+
Bill> | 1  | bill | localhost | UGTZ | Sleep          | 
Bill> 117  |                 |     |     [...]
Bill> | 31 |      |           | UGTZ | Delayed_insert | 29   | Waiting on cond | 
Bill> T   |
Bill> | 32 |      |           | UGTZ | Delayed_insert | 29   | Waiting on cond | 
Bill> T2  |


Bill> The Mysql manual says this about INSERT DELAYED:

>> When you use INSERT DELAYED, the client will get an ok at once and the row
>> will be inserted when the table is not in use by any other thread.
>> 
>> Another major benefit of using INSERT DELAYED is that inserts from many
>> clients are bundled together and written in one block. This is much faster
>> than doing many separate inserts.

Bill> Well, no one else seems to be using the table, so why not complete the write?

Bill> Perhaps it's waiting for more inserts to do them in a bundle?  (that seems 
Bill> questionable given that waiting may be undesirable).

When you do an INSERT DELAYED, MySQL creates a new thread that will
handle all INSERT DELAYED statements for this table.  This thread will 
show up on 'mysqladmin processlist', but will not take any CPU and
very little resources.

The INSERT of the row will be done at once the table is not used by
any other thread.

You can check this by doing 'mysqladmin extended-status'. The
variable:

Delayed_writes

Tells you how many rows hasn't yet been written.

The normal 'lifetime' of a insert delayed thread is
'delayed_insert_timeout', which is 300 seconds by default.
(You can check this with mysqladmin variables)

Regards,
Monty
Thread
Delayed_insert - Waiting on condBill Marrs5 Nov
  • Re: Delayed_insert - Waiting on condsinisa5 Nov
    • Re: Delayed_insert - Waiting on condBill Marrs5 Nov
      • Re: Delayed_insert - Waiting on condsinisa5 Nov
  • Delayed_insert - Waiting on condMichael Widenius10 Nov