Comments (2)
Both EXPLAIN
outputs seem identical, any chance this is the same thing pasted twice?
from mysql-5.6.
Both
EXPLAIN
outputs seem identical, any chance this is the same thing pasted twice?
It's my fault, I pasted wrong text for the second one.
Now I have re-run the two explain
on a larger data set and updated the above result -- the second explain
result is ok, the query plan using key_len
12 and estimated rows is 13482. the first one is wrong, it using key_len
8, which causing slow index range scan.
Also I have reproduced this issue on upstream(Oracle) mysql-8.0.30, it seems this issue was inroduced in some recent revision by upstream mysql. So I worked around this issue by rewrite the relavant tpcc subquery to:
explain SELECT ol_i_id FROM bmsql_order_line WHERE (ol_w_id, ol_d_id, ol_o_id) IN
(WITH RECURSIVE nums AS (SELECT 1 AS value UNION ALL SELECT value + 1 AS value FROM nums WHERE nums.value < 20)
SELECT d_w_id, d_id, d_next_o_id - value
FROM nums cross join bmsql_district where d_w_id = 1 AND d_id = 5);
The new query force query plan to use the full 3 columns of the index(key_len
= 12):
+----+-------------+------------------+------------+-------+---------------+---------+---------+------------------+------+----------+----------------------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+-------------+------------------+------------+-------+---------------+---------+---------+------------------+------+----------+----------------------------+
| 1 | PRIMARY | bmsql_district | p0 | const | PRIMARY | PRIMARY | 8 | const,const | 1 | 100.00 | NULL |
| 1 | PRIMARY | <derived3> | NULL | ALL | NULL | NULL | NULL | NULL | 3 | 100.00 | Start temporary |
| 1 | PRIMARY | bmsql_order_line | p0 | ref | PRIMARY | PRIMARY | 12 | const,const,func | 10 | 100.00 | Using where; End temporary |
| 3 | DERIVED | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | No tables used |
| 4 | UNION | nums | NULL | ALL | NULL | NULL | NULL | NULL | 2 | 50.00 | Recursive; Using where |
+----+-------------+------------------+------------+-------+---------------+---------+---------+------------------+------+----------+----------------------------+
Since this is an upstream issue, if myrocks team have no interest on tracking this issue, just close it.
from mysql-5.6.
Related Issues (20)
- MyRocks memory grows unlimitedly after a lot of compactions HOT 15
- Warning from compiling clone_os.cc HOT 6
- advisable to use many databases or many more tables?
- MyRocks 8.0.28 hangs during the insert benchmark HOT 6
- force_flush_memtable_and_lzero_now always compacts to physical L1
- Make compilation faster HOT 1
- How to achieve ~20% replication throughput improvement using Read Free Replication (RFR) feature
- Keep long-running MyRocks mtr tests in their own suite HOT 1
- MyRocks 8.0.28 has poor performance of primary key range query HOT 1
- create secondary index needs attention
- issue while install HOT 1
- Error during create secondary index
- Update the Build Steps page HOT 1
- MyRocks engine should respect WITH_UNIT_TESTS
- Allow users to manually set the number of block cache shards HOT 1
- Provide a counter to show pending compaction bytes for RocksDB
- MyRocks does commit step non-durably under server group 2PC protocol HOT 1
- alter talbe add index optimization
- Range lock support HOT 2
- Cached RocksDB transaction object accessed after delete by XA COMMIT
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mysql-5.6.