1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

MDEV-14500 filesort to support engines with slow rnd_pos

If the engine wants to avoid rnd_pos() - force a temporary table
before a filesort. But don't do it if addon_fields are used.
This commit is contained in:
Sergei Golubchik
2018-11-16 18:28:01 +01:00
parent cd29aee50d
commit f0f0d07250
8 changed files with 142 additions and 25 deletions

View File

@ -13193,6 +13193,21 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond,
JOIN_TAB *head= join->join_tab + join->const_tables;
*simple_order= head->on_expr_ref[0] == NULL;
if (*simple_order && head->table->file->ha_table_flags() & HA_SLOW_RND_POS)
{
uint u1, u2, u3;
/*
normally the condition is (see filesort_use_addons())
length + sortlength <= max_length_for_sort_data
but for HA_SLOW_RND_POS tables we relax it a bit, as the alternative
is to use a temporary table, which is rather expensive.
TODO proper cost estimations
*/
*simple_order= filesort_use_addons(head->table, 0, &u1, &u2, &u3);
}
}
else
{