concurrent insert documentation clarification

2001-12-12 Thread Michael Griffith

The MySQL documentation says:

To ensure that the update log/binary log can be used to re-create the
original tables, MySQL will not allow concurrent inserts during INSERT 
SELECT

Does this mean:

A.
An INSERT...SELECT cannot run if any other SELECT is running on the table

OR

B.
An INSERT...SELECT cannot run if another INSERT...SELECT is already running
on the table

Which is correct?

The wording of the documentation suggests that B is correct, but my actual
tests on the server indicate A is correct (MySQL 3.23.43 RH Linux 7.1)

Thanks



-
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




Re: concurrent insert documentation clarification

2001-12-12 Thread Benjamin Pflugmann

Hi.

On Wed, Dec 12, 2001 at 04:32:27AM -0700, [EMAIL PROTECTED] wrote:
 The MySQL documentation says:
 
 To ensure that the update log/binary log can be used to re-create the
 original tables, MySQL will not allow concurrent inserts during INSERT 
 SELECT
 
 Does this mean:

Normally, with MyISAM tables, MySQL will not allow any INSERT,
UPDATE..., while a SELECT is running and vice versa (they block each
other only if they are on the same table, of course). They will be
queued up and run sequentielly. This is handled by implicit locks.
Btw, there may only be one INSERT running on a table at a time, but
several SELECTs.

concurrent inserts is a feature which allows one INSERT to run
parallel to the running SELECTs on a table (with MyISAM tables),
without being blocked by the selects (under certain prerequisites,
which don't matter here), but still blocking subsequents selects. The
advantage is that a long running select doesn't block inserts, which
will block all following selects (which normally could run in parallel
to the slow select).

The note above explains that these concurrent INSERTs won't be allowed
while an INSERT ... SELECT is running. While another INSERT on the
target table won't be allowed anyhow (only one at a time!), INSERTs on
the source table won't be allowed, either.

 A.
 An INSERT...SELECT cannot run if any other SELECT is running on the table

No, that is not what the note is about. The note is about concurrent
inserts, not selects.

 OR
 
 B.
 An INSERT...SELECT cannot run if another INSERT...SELECT is already running
 on the table

Of course, it cannot: Two INSERTs at a time are never allowed, they
will be run one after the other.

 Which is correct?
 
 The wording of the documentation suggests that B is correct, but my actual
 tests on the server indicate A is correct (MySQL 3.23.43 RH Linux 7.1)

I agree that the wording of the documentation looks ambigious. It
should clearly state whether the source or the target table is meant.

And I could reproduce your testing (on 3.23.42). You are right that
case A, an already running SELECT, will block an INSERT ... SELECT
(but not a simple INSERT), which I think is a bug. Or the note is
incomplete.

Bye,

Benjamin.


-- 
[EMAIL PROTECTED]

-
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