[MDEV-19593] Split create_schema_table() into virtual methods in Type_handler Created: 2019-05-25 Updated: 2019-08-18 Resolved: 2019-05-25 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data types, Information Schema |
| Fix Version/s: | 10.5.0 |
| Type: | Task | Priority: | Major |
| Reporter: | Alexander Barkov | Assignee: | Alexander Barkov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
The code in create_schema_table() has switch's and if's testing MYSQL_TYPE_XXX. Additionally, when schema tables are created in two steps:
Let's do the following:
|
| Comments |
| Comment by Alexander Barkov [ 2019-08-17 ] | ||||||||||||||||
|
Results of this change look good in many aspects. Code change made summaryThe old code made a really hard job on every INFORMATION_SCHEMA query:
The new code just creates a table directly from the array of ST_FIELD_INFO without such heavy conversion Unnecessary classes removedThese classes were used only in I_S table creation, in the ST_FIELD_INFO->Item->Field chain:
After this change these classes were not needed any more, so they were removed. Creation of INFORMATION_SCHEMA tables is now fasterI_S tables are now created directly from an array of ST_FIELD_INFO, no such heavy conversion involved any more. This example code runs 1% faster after the change:
The code is now data type friendlyI_S columns of new data types now work out of the box, without a need of new wrapper classes like the former Item_blob, Item_return_date_time or Item_return_int. A new data type developer just needs to override Type_handler_xxx::create_schema_field(), which is one line method with a single new Field_xxx() statement.
It's now easy to extend creating of temporary tablesThe new class Create_tmp_table now understands two input data formats:
Adding new formats is now trivial and does not need heavy conversion like ST_FIELD_INFO->Item->Field. One just needs to add a proper add_fields() method. Examples:
|