MDEV-415: Back-port of the WL task #1393 from the mysql-5.6 code line.

The task adds a more efficient handling of the queries with 
ORDER BY order LIMIT n, such that n is small enough and
no indexes are used for order.
This commit is contained in:
Igor Babaev 2012-09-01 14:21:59 -07:00
commit a6b88f1431
29 changed files with 2600 additions and 221 deletions

View file

@ -498,13 +498,15 @@ int mysql_update(THD *thd,
uint length= 0;
SORT_FIELD *sortorder;
ha_rows examined_rows;
ha_rows found_rows;
table->sort.io_cache = (IO_CACHE *) my_malloc(sizeof(IO_CACHE),
MYF(MY_FAE | MY_ZEROFILL));
if (!(sortorder=make_unireg_sortorder(order, &length, NULL)) ||
(table->sort.found_records= filesort(thd, table, sortorder, length,
select, limit, 1,
&examined_rows))
select, limit,
true,
&examined_rows, &found_rows))
== HA_POS_ERROR)
{
goto err;