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

Adjusting the optimizer cost model

To generate execution plans, the optimizer uses a cost model that is based on estimates of the cost of various operations that occur during query execution. The optimizer has a set of compiled-in default cost constants available to it, to make decisions regarding execution plans. You can adjust them by updating or inserting the mysql.engine_cost table and executing the FLUSH OPTIMIZER_COSTS command:

mysql> SELECT * FROM mysql.engine_cost\G*************************** 1. row ***************************  engine_name: InnoDB  device_type: 0    cost_name: io_block_read_cost   cost_value: 1  last_update: 2017-11-20 16:24:56      comment: NULLdefault_value: 1*************************** 2. row *************************** engine_name: ...

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