Bug #25914 MySQL optimizer should be aware that SELECT ... FOR UPDATE is not key read
| Submitted: | 29 Jan 2007 13:03 | Modified: | 13 Nov 2007 17:19 |
|---|---|---|---|
| Reporter: | Heikki Tuuri | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: Optimizer | Severity: | S4 (Feature request) |
| Version: | 5.1 | OS: | Any (All) |
| Assigned to: | CPU Architecture: | Any |
[29 Jan 2007 13:03]
Heikki Tuuri
[29 Jan 2007 13:08]
Heikki Tuuri
Hmm, actually, since a FOR UPDATE query should lock as few rows as possible, if we use in 5.1 the default REPEATABLE READ isolation level, it makes sense always to use a secondary index if possible. In 5.1, when using the READ COMMITTED isolation level, MySQL/InnoDB does release the X-lock on rows that do not match. Since in the future, most users will probably change to READ COMMITTED and row-based replication. Thus, the optimization should on the REPEATABLE READ isolation level favor always a secondary index scan, even if that is slow. But on the READ COMMITTED level it should choose a primary index scan if that is faster than a secondary index scan.
[13 Nov 2007 17:19]
Valeriy Kravchuk
Thank you for a reasonable feature request.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.