Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.1.18, 10.0(EOL), 10.1(EOL)
-
10.1.19, 10.1.20, 10.2.4-1, 10.2.4-2, 10.1.22, 10.1.23, 10.3.1-1, 10.1.29, 10.1.30, 10.1.31
Description
When a user uses partition selection in a SELECT query to only query a particular partition of a MyISAM table, many users would expect the server to only open the data files for that particular partition. In reality, the server opens all data files for the table.
This bug is related to partition selection in SELECT statements, as defined here:
http://dev.mysql.com/doc/refman/5.6/en/partitioning-selection.html
Let's say that we create the following table:
CREATE TABLE employees (
|
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
fname VARCHAR(25) NOT NULL,
|
lname VARCHAR(25) NOT NULL,
|
store_id INT NOT NULL,
|
department_id INT NOT NULL
|
) ENGINE=MyISAM
|
PARTITION BY RANGE(id) (
|
PARTITION p0 VALUES LESS THAN (5),
|
PARTITION p1 VALUES LESS THAN (10),
|
PARTITION p2 VALUES LESS THAN (15),
|
PARTITION p3 VALUES LESS THAN MAXVALUE
|
);
|
|
INSERT INTO employees VALUES
|
('', 'Bob', 'Taylor', 3, 2), ('', 'Frank', 'Williams', 1, 2),
|
('', 'Ellen', 'Johnson', 3, 4), ('', 'Jim', 'Smith', 2, 4),
|
('', 'Mary', 'Jones', 1, 1), ('', 'Linda', 'Black', 2, 3),
|
('', 'Ed', 'Jones', 2, 1), ('', 'June', 'Wilson', 3, 1),
|
('', 'Andy', 'Smith', 1, 3), ('', 'Lou', 'Waters', 2, 4),
|
('', 'Jill', 'Stone', 1, 4), ('', 'Roger', 'White', 3, 2),
|
('', 'Howard', 'Andrews', 1, 2), ('', 'Fred', 'Goldberg', 3, 3),
|
('', 'Barbara', 'Brown', 2, 3), ('', 'Alice', 'Rogers', 2, 2),
|
('', 'Mark', 'Morgan', 3, 3), ('', 'Karen', 'Cole', 3, 2);
|
And then we execute the following to ensure that the table's data files are closed:
FLUSH TABLES;
|
And then we can confirm that the table's data files are not open:
$ sudo lsof -p `pidof mysqld` | grep employees
|
And then let's say that we execute the following query:
SELECT * FROM employees PARTITION (p1);
|
Most users would expect that the server would only open the data files for partition p1. In reality, it opens all of them:
$ sudo lsof -p `pidof mysqld` | grep employees
|
mysqld 825 mysql 18u REG 202,2 2048 50336245 /var/lib/mysql/db1/employees#P#p0.MYI
|
mysqld 825 mysql 20u REG 202,2 120 50336246 /var/lib/mysql/db1/employees#P#p0.MYD
|
mysqld 825 mysql 23u REG 202,2 2048 50336247 /var/lib/mysql/db1/employees#P#p1.MYI
|
mysqld 825 mysql 24u REG 202,2 140 50336248 /var/lib/mysql/db1/employees#P#p1.MYD
|
mysqld 825 mysql 25u REG 202,2 2048 50336249 /var/lib/mysql/db1/employees#P#p2.MYI
|
mysqld 825 mysql 26u REG 202,2 148 50336250 /var/lib/mysql/db1/employees#P#p2.MYD
|
mysqld 825 mysql 27u REG 202,2 2048 50336251 /var/lib/mysql/db1/employees#P#p3.MYI
|
mysqld 825 mysql 28u REG 202,2 120 50336252 /var/lib/mysql/db1/employees#P#p3.MYD
|
Attachments
Issue Links
- causes
-
MDEV-18244 Server crashes in ha_innobase::update_thd / ... / ha_partition::update_next_auto_inc_val
-
- Closed
-
- relates to
-
MDEV-20250 Implement early partition pruning before statement start
-
- In Progress
-
-
MDEV-20376 Assertion in ha_maria::close() upon complex SELECT from specific data
-
- Closed
-
- links to
Activity
Field | Original Value | New Value |
---|---|---|
Description |
This bug is related to partition selection in SELECT statements, as defined here:
http://dev.mysql.com/doc/refman/5.6/en/partitioning-selection.html Let's say that we create the following table: {noformat} CREATE TABLE employees ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, fname VARCHAR(25) NOT NULL, lname VARCHAR(25) NOT NULL, store_id INT NOT NULL, department_id INT NOT NULL ) ENGINE=MyISAM PARTITION BY RANGE(id) ( PARTITION p0 VALUES LESS THAN (5), PARTITION p1 VALUES LESS THAN (10), PARTITION p2 VALUES LESS THAN (15), PARTITION p3 VALUES LESS THAN MAXVALUE ); INSERT INTO employees VALUES ('', 'Bob', 'Taylor', 3, 2), ('', 'Frank', 'Williams', 1, 2), ('', 'Ellen', 'Johnson', 3, 4), ('', 'Jim', 'Smith', 2, 4), ('', 'Mary', 'Jones', 1, 1), ('', 'Linda', 'Black', 2, 3), ('', 'Ed', 'Jones', 2, 1), ('', 'June', 'Wilson', 3, 1), ('', 'Andy', 'Smith', 1, 3), ('', 'Lou', 'Waters', 2, 4), ('', 'Jill', 'Stone', 1, 4), ('', 'Roger', 'White', 3, 2), ('', 'Howard', 'Andrews', 1, 2), ('', 'Fred', 'Goldberg', 3, 3), ('', 'Barbara', 'Brown', 2, 3), ('', 'Alice', 'Rogers', 2, 2), ('', 'Mark', 'Morgan', 3, 3), ('', 'Karen', 'Cole', 3, 2); {noformat} And then we execute the following to ensure that the table's data files are closed: {noformat} FLUSH TABLES; {noformat} And then we can confirm that the table's data files are not open: {noformat} $ sudo lsof -p `pidof mysqld` | grep employees {noformat} And then let's say that we execute the following query: {noformat} SELECT * FROM employees PARTITION (p1); {noformat} Most users would expect that the server would only open the data files for partition p1. In reality, it opens all of them: {noformat} $ sudo lsof -p `pidof mysqld` | grep employees mysqld 825 mysql 18u REG 202,2 2048 50336245 /var/lib/mysql/db1/employees#P#p0.MYI mysqld 825 mysql 20u REG 202,2 120 50336246 /var/lib/mysql/db1/employees#P#p0.MYD mysqld 825 mysql 23u REG 202,2 2048 50336247 /var/lib/mysql/db1/employees#P#p1.MYI mysqld 825 mysql 24u REG 202,2 140 50336248 /var/lib/mysql/db1/employees#P#p1.MYD mysqld 825 mysql 25u REG 202,2 2048 50336249 /var/lib/mysql/db1/employees#P#p2.MYI mysqld 825 mysql 26u REG 202,2 148 50336250 /var/lib/mysql/db1/employees#P#p2.MYD mysqld 825 mysql 27u REG 202,2 2048 50336251 /var/lib/mysql/db1/employees#P#p3.MYI mysqld 825 mysql 28u REG 202,2 120 50336252 /var/lib/mysql/db1/employees#P#p3.MYD {noformat} |
When a user uses partition selection in a SELECT query to only query a particular partition of a MyISAM table, many users would expect the server to only open the data files for that particular partition. In reality, the server opens all data files for the table.
This bug is related to partition selection in SELECT statements, as defined here: http://dev.mysql.com/doc/refman/5.6/en/partitioning-selection.html Let's say that we create the following table: {noformat} CREATE TABLE employees ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, fname VARCHAR(25) NOT NULL, lname VARCHAR(25) NOT NULL, store_id INT NOT NULL, department_id INT NOT NULL ) ENGINE=MyISAM PARTITION BY RANGE(id) ( PARTITION p0 VALUES LESS THAN (5), PARTITION p1 VALUES LESS THAN (10), PARTITION p2 VALUES LESS THAN (15), PARTITION p3 VALUES LESS THAN MAXVALUE ); INSERT INTO employees VALUES ('', 'Bob', 'Taylor', 3, 2), ('', 'Frank', 'Williams', 1, 2), ('', 'Ellen', 'Johnson', 3, 4), ('', 'Jim', 'Smith', 2, 4), ('', 'Mary', 'Jones', 1, 1), ('', 'Linda', 'Black', 2, 3), ('', 'Ed', 'Jones', 2, 1), ('', 'June', 'Wilson', 3, 1), ('', 'Andy', 'Smith', 1, 3), ('', 'Lou', 'Waters', 2, 4), ('', 'Jill', 'Stone', 1, 4), ('', 'Roger', 'White', 3, 2), ('', 'Howard', 'Andrews', 1, 2), ('', 'Fred', 'Goldberg', 3, 3), ('', 'Barbara', 'Brown', 2, 3), ('', 'Alice', 'Rogers', 2, 2), ('', 'Mark', 'Morgan', 3, 3), ('', 'Karen', 'Cole', 3, 2); {noformat} And then we execute the following to ensure that the table's data files are closed: {noformat} FLUSH TABLES; {noformat} And then we can confirm that the table's data files are not open: {noformat} $ sudo lsof -p `pidof mysqld` | grep employees {noformat} And then let's say that we execute the following query: {noformat} SELECT * FROM employees PARTITION (p1); {noformat} Most users would expect that the server would only open the data files for partition p1. In reality, it opens all of them: {noformat} $ sudo lsof -p `pidof mysqld` | grep employees mysqld 825 mysql 18u REG 202,2 2048 50336245 /var/lib/mysql/db1/employees#P#p0.MYI mysqld 825 mysql 20u REG 202,2 120 50336246 /var/lib/mysql/db1/employees#P#p0.MYD mysqld 825 mysql 23u REG 202,2 2048 50336247 /var/lib/mysql/db1/employees#P#p1.MYI mysqld 825 mysql 24u REG 202,2 140 50336248 /var/lib/mysql/db1/employees#P#p1.MYD mysqld 825 mysql 25u REG 202,2 2048 50336249 /var/lib/mysql/db1/employees#P#p2.MYI mysqld 825 mysql 26u REG 202,2 148 50336250 /var/lib/mysql/db1/employees#P#p2.MYD mysqld 825 mysql 27u REG 202,2 2048 50336251 /var/lib/mysql/db1/employees#P#p3.MYI mysqld 825 mysql 28u REG 202,2 120 50336252 /var/lib/mysql/db1/employees#P#p3.MYD {noformat} |
Remote Link | This issue links to "MySQL Bug #83434 - Select statement with partition selection against MyISAM table opens all partiti (Web Link)" [ 27700 ] |
Labels | myisam partitioning | myisam partitioning upstream |
Status | Open [ 1 ] | Confirmed [ 10101 ] |
Fix Version/s | 10.2 [ 14601 ] | |
Affects Version/s | 10.0 [ 16000 ] | |
Affects Version/s | 10.1 [ 16100 ] | |
Affects Version/s | 10.2 [ 14601 ] |
Assignee | Alexey Botchkov [ holyfoot ] |
Status | Confirmed [ 10101 ] | In Progress [ 3 ] |
Sprint | 10.1.19 [ 109 ] |
Rank | Ranked higher |
Sprint | 10.1.19 [ 109 ] | 10.1.19, 10.1.20 [ 109, 119 ] |
Rank | Ranked higher |
Fix Version/s | 10.2 [ 14601 ] |
Affects Version/s | 10.2 [ 14601 ] |
Sprint | 10.1.19, 10.1.20 [ 109, 119 ] | 10.1.19, 10.1.20, 10.1.21 [ 109, 119, 130 ] |
Sprint | 10.1.19, 10.1.20, 10.1.21 [ 109, 119, 130 ] | 10.1.19, 10.1.20, 10.2.4-1 [ 109, 119, 132 ] |
Rank | Ranked lower |
Sprint | 10.1.19, 10.1.20, 10.2.4-1 [ 109, 119, 132 ] | 10.1.19, 10.1.20, 10.2.4-1, 10.2.4-2 [ 109, 119, 132, 134 ] |
Sprint | 10.1.19, 10.1.20, 10.2.4-1, 10.2.4-2 [ 109, 119, 132, 134 ] | 10.1.19, 10.1.20, 10.2.4-1, 10.2.4-2, 10.0.30 [ 109, 119, 132, 134, 140 ] |
Sprint | 10.1.19, 10.1.20, 10.2.4-1, 10.2.4-2, 10.0.30 [ 109, 119, 132, 134, 140 ] | 10.1.19, 10.1.20, 10.2.4-1, 10.2.4-2, 10.1.22 [ 109, 119, 132, 134, 143 ] |
Sprint | 10.1.19, 10.1.20, 10.2.4-1, 10.2.4-2, 10.1.22 [ 109, 119, 132, 134, 143 ] | 10.1.19, 10.1.20, 10.2.4-1, 10.2.4-2, 10.1.22, 10.1.23 [ 109, 119, 132, 134, 143, 154 ] |
Rank | Ranked lower |
Sprint | 10.1.19, 10.1.20, 10.2.4-1, 10.2.4-2, 10.1.22, 10.1.23 [ 109, 119, 132, 134, 143, 154 ] | 10.1.19, 10.1.20, 10.2.4-1, 10.2.4-2, 10.1.22, 10.1.23, 10.1.24 [ 109, 119, 132, 134, 143, 154, 161 ] |
Sprint | 10.1.19, 10.1.20, 10.2.4-1, 10.2.4-2, 10.1.22, 10.1.23, 10.1.24 [ 109, 119, 132, 134, 143, 154, 161 ] | 10.1.19, 10.1.20, 10.2.4-1, 10.2.4-2, 10.1.22, 10.1.23, 10.3.1-1 [ 109, 119, 132, 134, 143, 154, 164 ] |
Rank | Ranked lower |
Assignee | Alexey Botchkov [ holyfoot ] | Sergei Golubchik [ serg ] |
Status | In Progress [ 3 ] | In Review [ 10002 ] |
Sprint | 10.1.19, 10.1.20, 10.2.4-1, 10.2.4-2, 10.1.22, 10.1.23, 10.3.1-1 [ 109, 119, 132, 134, 143, 154, 164 ] | 10.1.19, 10.1.20, 10.2.4-1, 10.2.4-2, 10.1.22, 10.1.23, 10.3.1-1, 10.1.29 [ 109, 119, 132, 134, 143, 154, 164, 202 ] |
Sprint | 10.1.19, 10.1.20, 10.2.4-1, 10.2.4-2, 10.1.22, 10.1.23, 10.3.1-1, 10.1.29 [ 109, 119, 132, 134, 143, 154, 164, 202 ] | 10.1.19, 10.1.20, 10.2.4-1, 10.2.4-2, 10.1.22, 10.1.23, 10.3.1-1, 10.1.29, 10.1.30 [ 109, 119, 132, 134, 143, 154, 164, 202, 215 ] |
Rank | Ranked higher |
Assignee | Sergei Golubchik [ serg ] | Alexey Botchkov [ holyfoot ] |
Status | In Review [ 10002 ] | Stalled [ 10000 ] |
Assignee | Alexey Botchkov [ holyfoot ] | Sergei Golubchik [ serg ] |
Status | Stalled [ 10000 ] | In Review [ 10002 ] |
Fix Version/s | 10.3 [ 22126 ] | |
Fix Version/s | 10.1 [ 16100 ] |
Assignee | Sergei Golubchik [ serg ] | Alexey Botchkov [ holyfoot ] |
Status | In Review [ 10002 ] | Stalled [ 10000 ] |
Sprint | 10.1.19, 10.1.20, 10.2.4-1, 10.2.4-2, 10.1.22, 10.1.23, 10.3.1-1, 10.1.29, 10.1.30 [ 109, 119, 132, 134, 143, 154, 164, 202, 215 ] | 10.1.19, 10.1.20, 10.2.4-1, 10.2.4-2, 10.1.22, 10.1.23, 10.3.1-1, 10.1.29, 10.1.30, 10.1.31 [ 109, 119, 132, 134, 143, 154, 164, 202, 215, 225 ] |
Status | Stalled [ 10000 ] | In Progress [ 3 ] |
issue.field.resolutiondate | 2018-01-29 07:32:41.0 | 2018-01-29 07:32:41.475 |
Fix Version/s | 10.3.5 [ 22905 ] | |
Fix Version/s | 10.3 [ 22126 ] | |
Resolution | Fixed [ 1 ] | |
Status | In Progress [ 3 ] | Closed [ 6 ] |
Link |
This issue causes |
Link | This issue relates to MDEV-20250 [ MDEV-20250 ] |
Link |
This issue relates to |
Workflow | MariaDB v3 [ 78000 ] | MariaDB v4 [ 151090 ] |
Zendesk Related Tickets | 152974 |
Reproducible on MySQL 5.6, 5.7.