diff options
author | Sergei Golubchik <serg@mariadb.org> | 2020-08-01 13:12:50 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2020-10-23 13:37:26 +0200 |
commit | e64084d5a3a72462fa6263d1d0a86e72c0ba0d47 (patch) | |
tree | 123beda4bb88dbce9a4f3fe3ab4b659a95caeef6 /sql/sql_lex.cc | |
parent | 6cefe7d31ef43cadb905d71be743462825c7b4ff (diff) | |
download | mariadb-git-e64084d5a3a72462fa6263d1d0a86e72c0ba0d47.tar.gz |
MDEV-21201 No records produced in information_schema query, depending on projection
Reimplement MDEV-14275 Improving memory utilization for information schema
Postpone temp table instantiation until after setup_fields().
Replace all unused (not marked in read_set) columns in an I_S table
with CHAR(0). This can drastically reduce the footprint of a MEMORY
table (a TABLE_CATALOG alone is 1538 bytes per row).
This does not change the engine. If the table was decided to be Aria
(because of, say, blobs) then after optimization it'll stay Aria
even if all blobs were removed.
Note 1: when transforming table structure, share->blob_fields is
preserved, otherwise Aria might switch from DYNAMIC to STATIC row format
and expect a special field for a deleted mark, which create_tmp_tabe
didn't provide.
Note 2: optimizer was doing handler::info() (to know the number of rows)
before the temp table is populated. That didn't make much sense. Now
it's done before the table is even instantiated. Preserve the old
behavior and report 0 rows.
This reverts e2664ee8362 and a8458a2345e
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r-- | sql/sql_lex.cc | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 4f64dbfbbf9..b5483c671de 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -3312,21 +3312,21 @@ bool LEX::can_not_use_merged() } } -/* - Detect that we need only table structure of derived table/view +/** + Detect that we need only table structure of derived table/view. - SYNOPSIS - only_view_structure() + Also used by I_S tables (@see create_schema_table) to detect that + they need a full table structure and cannot optimize unused columns away - RETURN - TRUE yes, we need only structure - FALSE no, we need data + @retval TRUE yes, we need only structure + @retval FALSE no, we need data */ bool LEX::only_view_structure() { switch (sql_command) { case SQLCOM_SHOW_CREATE: + case SQLCOM_CHECKSUM: case SQLCOM_SHOW_TABLES: case SQLCOM_SHOW_FIELDS: case SQLCOM_REVOKE_ALL: @@ -3334,6 +3334,8 @@ bool LEX::only_view_structure() case SQLCOM_GRANT: case SQLCOM_CREATE_VIEW: return TRUE; + case SQLCOM_CREATE_TABLE: + return create_info.like(); default: return FALSE; } |