O'Reilly logo

MySQL 8 Cookbook by Karthik Appigatla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Partition selection

Partition pruning is automatic selection based on the WHERE clause. You can explicitly specify the partitions to scan in the query. The queries can be SELECT, DELETE, INSERT, REPLACE, UPDATE, LOAD DATA, and LOAD XML. The PARTITION option is used to select partitions from a given table, you should specify the keyword PARTITION <partition name> immediately following the name of the table, before all other options, including any table alias, for example:

mysql> SELECT emp_no,hire_date FROM employees PARTITION (p1990) LIMIT 10;+--------+------------+| emp_no | hire_date  |+--------+------------+| 413688 | 1989-12-10 || 242368 | 1989-08-06 || 283280 | 1985-11-22 || 405098 | 1985-11-16 ||  30404 | 1985-07-17 || 419259 | 1988-03-21 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required