[MDEV-8687] CREATE TEMPORARY TABLE vs plain SELECT causes 280x perf drop: InnoDB takes unneeded locks Created: 2015-08-28 Updated: 2015-10-23 Resolved: 2015-10-23 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB, Storage Engine - XtraDB |
| Affects Version/s: | 10.0, 10.1 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Critical |
| Reporter: | Stewart Smith | Assignee: | Jan Lindström (Inactive) |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | innodb | ||
| Environment: |
ppc64el |
||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Sprint: | 10.0.22 | ||||||||
| Description |
|
With the attached SQL and psdoit script to run queries concurrently, you can see that the CREATE TEMPORARY TABLE part of the query causes concurrency to tank. The related issue of It appears that CREATE TEMPORARY TABLE is triggering InnoDB to go and do a whole bunch of locking that it doesn't do when you just run a plain SELECT. The addition of CREATE TEMPORARY TABLE makes performance 280x worse.
Things get very bad, very fast. We spend almost all our time in a locking
and:
|
| Comments |
| Comment by Stewart Smith [ 2015-08-31 ] | ||||||||||||||||||||||||||||||||||||||||||
|
One possibility as to what's going on is that InnoDB is taking locks as if statement based binary logging is enabled. I'd argue that in this day and age, it should do so based on mixed mode replication rather than statement based, although I haven't looked at what the default binlog-format is in modern MariaDB (although there's probably a strong case for mixed mode if it isn't already) | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2015-09-01 ] | ||||||||||||||||||||||||||||||||||||||||||
Small values are too volatile for meaningful comparison. High values are better on MySQL everywhere, on 5.7 they are quite impressive (but even on 5.6 they are much better than 10.0/10.1). | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergey Vojtovich [ 2015-09-08 ] | ||||||||||||||||||||||||||||||||||||||||||
|
jplindst, could you check this? Should we merge fix from MySQL? | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Jan Lindström (Inactive) [ 2015-10-23 ] | ||||||||||||||||||||||||||||||||||||||||||
|
This is not a bug as default isolation level is REPEATABLE_READ. For plain select we do not need to take row locks, instead a consistent read is enough. But for CREATE [TEMPORARY] TABLE ... SELECT we need to take row locks to maintain selected range consistent also remember that InnoDB does not know is binary log used or not only for innodb-locks-unsafe-for-binlog case is optimized. |