Hi, I want to access data from an InnoDB table. I know that I can do this using the corresponding handler and ha_rnd_next() or ha_index_next(). My problem is that the original MySQL code is outperforming my implementation even on simple projection queries, even though I use the same functions.
The entry point for my own execution is in the sql_parce.cc file in the function int mysql_execute_command(THD *thd). ~line 2600 res= execute_sqlcom_select(thd, all_tables); database: http://dev.mysql.com/doc/employee/en/index.html query: select title from titles; my code: while (!tables->table->file->ha_rnd_next(tables->table->record[0])) { result->send_data(thd->lex->select_lex.item_list); } handler->ha_index_or_rnd_end(); return; result is of the type select_send To evaluate the query, using this simple loop, takes around 20 percent longer than the original MySQL code. I have used a debugger to step through the code, but the code being executed seems to be the same. That's why I think MySQL is doing some kind of optimization on the table but I can't figure out where. I have also tried to let my code run later in the evaluation process of MySQL but the result stays the same. Best regards, Tobias Krueger