Bug #117085 | Performance issue with Multi-Valued Index and ORDER BY DESC LIMIT (Reads more data than expected) | ||
---|---|---|---|
Submitted: | 31 Dec 2024 8:50 | Modified: | 31 Dec 2024 9:28 |
Reporter: | Eunbin Baek | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S5 (Performance) |
Version: | 8.0.40 | OS: | Any |
Assigned to: | CPU Architecture: | x86 | |
Tags: | DESC, multi-valued index, regression |
[31 Dec 2024 8:50]
Eunbin Baek
[31 Dec 2024 8:51]
Eunbin Baek
This is the test data for reproducing the issue.
Attachment: mvi_test.sql (application/octet-stream, text), 15.10 MiB.
[31 Dec 2024 9:28]
MySQL Verification Team
Hello Eunbin Baek, Thank you for the report and test case. Verified as described. -- 8.0.40 bin/mysql -uroot -S/tmp/mysql.sock Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 9 Server version: 8.0.40 MySQL Community Server - GPL Copyright (c) 2000, 2024, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> use test Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> select * from t1 where 50 member of (ids->'$[*]') and id < 4098 order by id desc limit 10; +------+------+----------+------+ | id | col1 | col2 | ids | +------+------+----------+------+ | 4097 | 2522 | 52d799a8 | [50] | | 4096 | 5874 | 52d79930 | [50] | | 4095 | 2283 | 52d798b8 | [50] | | 4094 | 5179 | 52d797fa | [50] | | 4093 | 1205 | 52d794c6 | [50] | +------+------+----------+------+ 5 rows in set (2.15 sec) mysql> select * from t1 where 50 member of (ids->'$[*]') and id < 4098 order by id desc limit 10; +------+------+----------+------+ | id | col1 | col2 | ids | +------+------+----------+------+ | 4097 | 2522 | 52d799a8 | [50] | | 4096 | 5874 | 52d79930 | [50] | | 4095 | 2283 | 52d798b8 | [50] | | 4094 | 5179 | 52d797fa | [50] | | 4093 | 1205 | 52d794c6 | [50] | +------+------+----------+------+ 5 rows in set (2.04 sec) mysql> select * from t1 where 50 member of (ids->'$[*]') and id < 4098 order by id desc limit 10; +------+------+----------+------+ | id | col1 | col2 | ids | +------+------+----------+------+ | 4097 | 2522 | 52d799a8 | [50] | | 4096 | 5874 | 52d79930 | [50] | | 4095 | 2283 | 52d798b8 | [50] | | 4094 | 5179 | 52d797fa | [50] | | 4093 | 1205 | 52d794c6 | [50] | +------+------+----------+------+ 5 rows in set (2.03 sec) mysql> select * from t1 where 50 member of (ids->'$[*]') and id < 4098 order by id desc limit 10; +------+------+----------+------+ | id | col1 | col2 | ids | +------+------+----------+------+ | 4097 | 2522 | 52d799a8 | [50] | | 4096 | 5874 | 52d79930 | [50] | | 4095 | 2283 | 52d798b8 | [50] | | 4094 | 5179 | 52d797fa | [50] | | 4093 | 1205 | 52d794c6 | [50] | +------+------+----------+------+ 5 rows in set (2.03 sec) -- 8.0.39 bin/mysql -uroot -S/tmp/mysql.sock Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 9 Server version: 8.0.39 MySQL Community Server - GPL Copyright (c) 2000, 2024, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> use test Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> select * from t1 where 50 member of (ids->'$[*]') and id < 4098 order by id desc limit 10; +------+------+----------+------+ | id | col1 | col2 | ids | +------+------+----------+------+ | 4097 | 2522 | 52d799a8 | [50] | | 4096 | 5874 | 52d79930 | [50] | | 4095 | 2283 | 52d798b8 | [50] | | 4094 | 5179 | 52d797fa | [50] | | 4093 | 1205 | 52d794c6 | [50] | +------+------+----------+------+ 5 rows in set (0.00 sec) . . +------+------+----------+------+ 5 rows in set (0.00 sec) +------+------+----------+------+ 5 rows in set (0.00 sec) +------+------+----------+------+ 5 rows in set (0.00 sec) regards, Umesh