4번독수리의 둥지

Select tables optimized away 본문

Database/MySQL

Select tables optimized away

4번독수리 2015. 10. 23. 14:13

http://stackoverflow.com/questions/1992312/meaning-of-select-tables-optimized-away-in-mysql-explain-plan

 

It means you have done a query that does nothing more than count the number of rows in a table, and that table is a MyISAM table. MyISAM tables are stored with a separate row count, so to do this query MySQL doesn't need to look at any of the table row data at all. Instead it immediately returns the pre-calculated row count. Hence the table access is ‘optimized away’ and the query is lightning-fast.

The same won't happen on other storage engines in MySQL such as InnoDB. But really, you want to be using InnoDB and not MyISAM in most cases for a variety of other reasons. (And even without the row count optimisation this kind of query is very, very fast.)

'Database > MySQL' 카테고리의 다른 글

MySQL DATE_ADD() vs php strtotime()  (0) 2016.09.21
SQL JOIN  (0) 2016.02.24
Correct indexing when using OR operator  (0) 2015.09.08
get MySQL binlog as SQL  (0) 2015.07.20
mysql prepared statement  (0) 2014.10.21