mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-14275 Improving memory utilization for information schema
SELECT queries on information_schema table will now not store data in the temporary table for columns that are not used in the query. This can drastically reduce memory when there are many rows involved in a query, like using SELECT table_name FROM information_schema.table on a system with many tables. The difference for the above query is about 14K per existing table. The code works this way: - Create a bitmap for all information_schema fields used in the query - For BLOB and VARCHAR fields that are not use, create a Field_null field.
This commit is contained in:
@ -16685,11 +16685,15 @@ Field *Item::create_field_for_schema(THD *thd, TABLE *table)
|
||||
{
|
||||
Field *field;
|
||||
if (max_length > MAX_FIELD_VARCHARLENGTH)
|
||||
field= new Field_blob(max_length, maybe_null, &name,
|
||||
collation.collation);
|
||||
field= new (thd->mem_root) Field_blob(max_length, maybe_null, &name,
|
||||
collation.collation);
|
||||
else if (max_length > 0)
|
||||
field= new (thd->mem_root) Field_varstring(max_length, maybe_null, &name,
|
||||
table->s,
|
||||
collation.collation);
|
||||
else
|
||||
field= new Field_varstring(max_length, maybe_null, &name,
|
||||
table->s, collation.collation);
|
||||
field= new Field_null((uchar*) 0, 0, Field::NONE, &name,
|
||||
collation.collation);
|
||||
if (field)
|
||||
field->init(table);
|
||||
return field;
|
||||
|
Reference in New Issue
Block a user