On 13.11.2007 20:57 CE(S)T, Baron Schwartz wrote:
> It will absolutely lock SELECTs.  Are you sure autocommit is set to 0 
> and you have an open transaction?  Are you sure your table is InnoDB? 
> I'm doing this right now:
> 
> -- cxn 1
> mysql> set autocommit=0;
> mysql> begin;
> mysql> select * from t1 for update;
> +------+
> | a    |
> +------+
> |    1 |
> +------+
> 1 row in set (0.00 sec)
> 
> -- cxn 2
> mysql> set autocommit=0;
> mysql> begin;
> mysql> select * from t1 for update;

Okay, my fault, I didn't use the "FOR UPDATE" in the second connection.
If I do (which is likely to be the case in an application because there,
the same code is run concurrently), the second SELECT locks. (The same
is true when I select MAX(id) instead of *.) If I don't, it still works.
Okay, so we have some table locking, tested, working. Very nice. Thank
you for this one. :)

> ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction

-- 
Yves Goergen "LonelyPixel" <[EMAIL PROTECTED]>
Visit my web laboratory at http://beta.unclassified.de

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to