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

MDEV-13049 Querying INFORMATION_SCHEMA becomes slow in MariaDB 10.1

Optimizations:
* avoid faster ext_table_discovery_simple() *only* when there are
  engines with discover_table_names() method *and* they look at
  file names. P_S implements discover_table_names(), but it's not
  a reason to use slower extension_based_table_discovery().
* don't pre-sort table names if ORDER BY or GROUP BY was specified
* starting from 10.3 only sort table names for SHOW commands
This commit is contained in:
Sergei Golubchik
2017-10-06 18:16:46 +02:00
parent 559dec33cc
commit 9b11956e86
2 changed files with 17 additions and 9 deletions

View File

@ -979,13 +979,20 @@ find_files(THD *thd, Dynamic_array<LEX_STRING*> *files, LEX_STRING *db,
if (tl.add_file(file->name))
goto err;
}
tl.sort();
}
else
{
if (ha_discover_table_names(thd, db, dirp, &tl, false))
goto err;
}
#if MYSQL_VERSION_ID < 100300
/* incomplete optimization, but a less drastic change in GA version */
if (!thd->lex->select_lex.order_list.elements &&
!thd->lex->select_lex.group_list.elements)
#else
if (is_show_command(thd))
#endif
tl.sort();
DBUG_PRINT("info",("found: %zu files", files->elements()));
my_dirend(dirp);