List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:May 18 1999 3:17am
View as plain text  
At 11:01 AM -0800 1/6/2000, Michael Palm wrote:
>[I am very new to mysql so I hope this ins't too silly}:
>The documentation for insert and update says:
>"if you specify the keyword LOW_PRIORITY, execution of the (insert or
>is delayed until no other clients are reading from the table".
>However, if I submit a select which takes a long time, any insert or
>on a queried table seems to wait until the select has completed or been
>even without using LOW_PRIORITY. Am I doing something wrong here?

No.  INSERT operations always have to wait for SELECT operations
if the SELECT is in progress at the time that the INSERT is issued.
The difference between using and not using LOW_PRIORITY is this:

If you don't use LOW_PRIORITY, the INSERT will block SELECT statements
that are issued after the INSERT.  So if a SELECT is in progress,
the INSERT will block until the SELECT finishes.  Then the INSERT is
done.  Then the other SELECTs are done.

With LOW_PRIORITY, if a SELECT is in progress, the INSERT blocks until
the SELECT finishes.  If no more SELECTs have come in in the meantime,
the INSERT proceeds.  However, if other SELECTs have come in and are
pending by the time the initial SELECT finishes, those SELECTs take
priority over the INSERT, even though the INSERT arrived earlier.
The INSERT is executed only when no other SELECTs are pending.
(This is what the manual means when is says that "the insert is delayed
until no other clients are reading from the table.)

That's my understanding of it, anyway.  If that's wrong, someone please
correct me.

Paul DuBois, paul@stripped
Northern League Chronicles:
  • Re: INSERT, SELECT and LOW_PRIORITYPaul DuBois18 May
    • Re: INSERT, SELECT and LOW_PRIORITYChristian Mack18 May