MySQL Forums
Forum List  »  InnoDB

InnoDB is default engine for 5.7, but why does the code go into myisam while debugging?
Posted by: wk chen
Date: December 28, 2016 02:43AM

Hi all,

Today, I download the source code of mysql 5.7.16, and build it with debug. It is said from 5.5, the default DB engine is InnoDB. But after I import my data with 8000000+ records into it. The I run select count(*) from my table, like:

mysql> flush table;
Query OK, 0 rows affected (0.01 sec)

mysql> SELECT SQL_NO_CACHE COUNT(*) FROM tmp_rpt;
+----------+
| COUNT(*) |
+----------+
| 8641282 |
+----------+
1 row in set (0.00 sec)

mysql>

It is strange, the timing is just 0 sec, and it is said that InnoDB will go through each record to calculate the number, and my table has 8000000+ records, so the timing is not reasonable, and the mysqld I built is debug version, it should be more slower to run.

Then I check my mysql to make sure InnoDB is used, like:

mysql> show variables like 'innodb_version' \G;
*************************** 1. row ***************************
Variable_name: innodb_version
Value: 5.7.16
1 row in set (0.01 sec)

ERROR:
No query specified

mysql> show variables like 'innodb_%io_threads' \G;
*************************** 1. row ***************************
Variable_name: innodb_read_io_threads
Value: 4
*************************** 2. row ***************************
Variable_name: innodb_write_io_threads
Value: 4
2 rows in set (0.01 sec)

ERROR:
No query specified

mysql> show engines;
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO |
| MyISAM | YES | MyISAM storage engine | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| ARCHIVE | YES | Archive storage engine | NO | NO | NO |
| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |
| FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
9 rows in set (0.00 sec)

Based on the message, InnoDB is the default engine.

To make sure, the InnoDB code is running, and I use gdb to trace the code step by step while I am running a more complicated select. But I find the code go into myisam code, like 'mi_scan':

lqq/home/alvin/mysql/storage/myisam/mi_scan.cqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
x27 DBUG_RETURN(0); x
x28 } x
x29 x
x30 /* x
x31 Read a row based on position. x
x32 If filepos= HA_OFFSET_ERROR then read next row x
x33 Return values x
x34 Returns one of following values: x
x35 0 = Ok. x
x36 HA_ERR_END_OF_FILE = EOF. x
x37 */ x
x38 x
x39 int mi_scan(MI_INFO *info, uchar *buf) x
x40 { x
x41 int result; x
B+>x42 DBUG_ENTER("mi_scan"); x
x43 /* Init all but update-flag */ x
x44 info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED); x
x45 result= (*info->s->read_rnd)(info, buf, info->nextpos, 1); x
x46 DBUG_RETURN(result); x
x47 } x
x48 x
x49 x
x50 x
x51 x
x52 x
x53 x
x54 x
x55 x
x56 x
x57 x
x58

Options: ReplyQuote


Subject
Views
Written By
Posted
InnoDB is default engine for 5.7, but why does the code go into myisam while debugging?
477
December 28, 2016 02:43AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.