>>>>> "Jules" == Jules Bean <jules@stripped> writes:
Jules> I've just noticed that all mysql internal locks are exclusive.
Jules> I.e., if thread 1 has a lock on table_a, then thread 2, also accessing
Jules> table_a, blocks until thread 1 is done.
Jules> I would have thought that the obvious design is to allowed shared read
Jules> locks, but make write locks require exclusive access?
Jules> For example:
Jules> Query 1:
Jules> SELECT * from employees WHERE name LIKE '%Bloggs%'; # slow query,
Jules> requires table scan
Jules> Query 2:
Jules> SELECT * from employees WHERE name='Smith'l # fast query, uses an
Jules> Now, unless I'm misunderstanding badly, mysql will lock query 2 until
Jules> query 1 finishes. I can see no reason that they shouldn't execute in
Jules> parallel (and then query 2 finishes much faster, query 1 slightly
Jules> Any plans in this direction?
MySQL does allow multiple readers (and single writers). If you have
some example that doesn't work as expected, please mail us about it!
Note however that some threads implementations (like BSDI:s) doesn't
balance between threads that good if you have a very CPU intensive
(MySQL 3.22.25 includes a fix for this for BSDI!)
PS: Please ALWAYS use the mysqlbug script when you post questions !