Method for Extending Data Table Fields to Support Multi-Tenant Shared Data Storage

By using a combination of basic tables and extended tables in multi-tenant shared data storage, the problems of low database space utilization and low query efficiency are solved, and infinite expansion and efficient query of data table fields are achieved.

CN115794811BActive Publication Date: 2025-07-08YANSHAN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211281596.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-19
Publication Date
2025-07-08
Estimated Expiration
2042-10-19

AI Technical Summary

Technical Problem

In the existing multi-tenant shared data storage method, there are problems such as low database space utilization and low data query efficiency, which cannot effectively meet the tenant's expansion needs for data table fields.

Method used

Using a combination scheme of basic tables, extended column metadata tables, extended tables and extended table metadata tables, the extended columns are initially expanded, and the tenant data information is obtained by combining internal connection queries.

Benefits of technology

It improves database space utilization and data query efficiency, and meets the unlimited expansion requirements of data table fields under multi-tenant shared data storage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115794811B_ABST
    Figure CN115794811B_ABST
Patent Text Reader

Abstract

The present invention relates to a method for extending data table fields that supports multi-tenant shared data storage, which includes the following steps: Step 1: Construct the basic table, extended column metadata table, extended table, and extended table metadata table for the tenant; Step 2: Obtain the data table field extension requirements of the tenant; Step 3: Persist the data table field extension for the tenant's shared data storage; Step 4: Determine the tenant's data information based on the basic table, extended column metadata table, extended table, and extended table metadata table. The extended column metadata table proposed by the present invention is used to store the customization information of different tenants; the extended table is used to meet the tenant's personalized customized field requirements after the extended columns are exhausted and store the tenant's customized information data; the extended table metadata table is used to store the personalized customization information of different tenants in the extended table. The database designed by the present invention can meet the data table field requirements in the multi-tenant shared data storage mode, has a high database space utilization rate, and improves the data query efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data storage and data management, and particularly to a method for extending data table fields that supports multi-tenant shared data storage. Background Art

[0002] Multi-tenant software provides the same or even customizable services to multiple tenants through a single software instance while ensuring tenant data isolation. Since different tenants have the same general functional requirements for software services, but different tenants have their own personalized requirements in specific details, multi-tenancy also means that multi-tenant software allows tenants to customize this shared software instance according to their special needs to meet the personalized needs of different tenants. The manifestation of this personalized customization requirement at the database level is mainly the extension of fields in the data table.

[0003] Since all tenants share the database and data tables in multi-tenant shared data storage, operations such as directly adding columns to the table structure of the database cannot be performed on the data table fields as in single-tenant software because the columns added by each tenant are completely useless to other tenants, which will cause chaos in the database table structure and a great waste of storage space. In existing methods for extending data table fields that support multi-tenant shared data storage, methods such as the wide table method, key-value pair method, private table method, XML data storage method, etc. are usually adopted. Although these existing technologies can solve the data table field extension requirements of multi-tenant shared data storage, there are problems such as low database space utilization or low data query efficiency.

[0004] To solve the above problems, new technical solutions need to be proposed. Summary of the Invention

[0005] To overcome the deficiencies of the prior art, the present invention provides a method for extending data table fields that supports multi-tenant shared data storage, which can effectively solve the database null value problem, improve the database space utilization efficiency, and at the same time improve the data query efficiency, and realize the data table field extension requirements of multi-tenant shared data storage.

[0006] To achieve the above object, the solution adopted by the present invention is as follows:

[0007] Step 1: Construct the basic table, extended column metadata table, extended table, and extended table metadata table of the tenant;

[0008] Construct a basic table containing extended columns and an extended column metadata table according to the initial business attributes, and construct a corresponding extended table and extended table metadata table according to the basic table;

[0009] Step 2: Obtain the tenant data table field extension requirements;

[0010] When a tenant requests an extension of the data table fields, the administrator reviews the requirement for the extension of the data table fields. The requirement for the extension of the tenant's data table fields that passes the review enters the persistence stage;

[0011] Step 3: Persist the extension of the data table fields stored in the tenant's shared data;

[0012] For the requirement for the extension of the tenant's data table fields that passes the review, check the remaining number of extended columns of the tenant in the base table. If the remaining number of extended columns is greater than 0, the current extension requirement is implemented using the extended columns in the base table; if the remaining number of extended columns is equal to 0, the current extension requirement is implemented using the extended table. The specific process of persisting the extension of the tenant's data table fields is as follows:

[0013] Both the extended columns and the extended table are used to meet the requirement for the extension of the tenant's data table fields. When a tenant requests an extension of the data table fields, first check the remaining number R of the extended columns of the tenant in the base table t , as follows:

[0014] R t = T(B t , T id );

[0015] In the formula: R t represents the number of extended columns that the tenant has not used in the base table; T represents the detection function for the remaining number of extended columns; B t represents the base table, and T id represents the tenant ID number;

[0016] The input of the detection function T is the base table name and the tenant ID number, which represents the operation of querying the remaining number of extended columns of the tenant in the base table through the tenant ID number, and the output is the number of remaining extended columns of the tenant in the base table;

[0017] When R t > 0, it means that the remaining number of extended columns of the tenant in the base table is greater than 0. At this time, use the extended columns to implement the tenant's extension requirement, store the metadata of the tenant's extended data in the extended column metadata table, and complete the data extension of the tenant;

[0018] When R t = 0, it means that the remaining number of extended columns of the tenant in the base table is equal to 0. At this time, use the extended table to meet the requirement for the tenant's data table fields. First, add a record in the extended table to store the field name extended by the tenant, and then store the metadata of the tenant's extended data in the extended table metadata table to complete the data extension of the tenant;

[0019] Step 4: Determine the tenant's data information based on the base table, the extended column metadata table, the extended table, and the extended table metadata table;

[0020] To determine the tenant data information, first query the data records of the tenant in the extension table. If there are no data records of the tenant in the extension table, the tenant's data information is only composed of the records in the basic table and the extended column metadata table. The tenant data information can be obtained by performing an inner join query on the basic table and the extended column metadata table. If there are data records of the tenant in the extension table, the tenant's data information is composed of the records in the basic table, the extended column metadata table, the extension table, and the extension table metadata table. By performing an inner join query on the above four tables, all the data information of the tenant can be obtained.

[0021] Preferably, the multi-tenant shared data storage means that all tenants share a single database and common data tables, and the information of all tenants is stored in the same table.

[0022] Preferably, the basic table in step 1 is specifically:

[0023] The basic table is different from the conventional basic table. In addition to the basic information fields constructed according to the initial business attributes, it also includes a certain number of extended column fields. The basic information fields are used to directly store the initial business attribute data of the tenant. The extended column fields are used to meet the tenant's data table field extension requirements. The number of extended columns is determined by software developers according to the software product characteristics during software design.

[0024] Preferably, the extension table in step 1 is specifically:

[0025] The extension table is an affiliated table associated with the basic table, which is used to meet the tenant's infinite extension requirements after the limited number of extended columns in the basic table are used up. The extension table is used to store at least the following fields: tenant ID field, extended field name field, and extended field value field.

[0026] Preferably, the extended column metadata table and the extension table metadata table in step 1 are specifically:

[0027] The extended column metadata table and the extension table metadata table are respectively affiliated tables associated with the basic table and the extension table. The extended column metadata table is used to store the metadata of the extended columns used in the basic table. The extension table metadata table is used to store the metadata of the extended attributes in the extension table.

[0028] Preferably, the process of determining the tenant's data information in step 4 is specifically:

[0029] To determine the tenant data information, first query the data records of the tenant in the extension table. If there are no data records of the tenant in the extension table, the tenant's data information is only composed of the records in the basic table and the extended column metadata table. The tenant data information can be obtained by performing an inner join query on the basic table and the extended column metadata table. At this time, the first all data information I of the tenantt1 As follows:

[0030] I t1 = G1(B t , M cm , T id );

[0031] In the formula: I t1 represents all the first data information of the tenant; G1 represents a function that obtains the tenant's data information from the join result in the basic table and the extended column metadata table based on the tenant ID; B t represents the basic table; M cm represents the extended column metadata table; T id represents the tenant ID number;

[0032] The input of the G1 function is the basic table name, the extended column metadata table name, and the tenant ID number, indicating that the operation is to perform an inner join query on the basic table and the extended column metadata table, and the output is all the data information of the tenant;

[0033] If there are data records of this tenant in the extended table, then the data information of this tenant is composed of the records in the basic table, the extended column metadata table, the extended table, and the extended table metadata table. By performing an inner join query on the above four tables, all the data information of the tenant is obtained; at this time, all the second data information I of the tenant t2 is as follows:

[0034] I t2 = G2(B t , M cm , E t , M tm , T id );

[0035] In the formula: I t2 represents all the second data information of the tenant; G2 represents a function that obtains all the data information of the tenant from the join result in the basic table, the extended column metadata table, the extended table, and the extended table metadata table based on the tenant ID; B t represents the basic table; M cm represents the extended column metadata table; E t represents the extended table; M tm represents the extended table metadata table; T id represents the tenant ID number;

[0036] The input of the G2 function is the basic table name, the extended column metadata table name, the extended table name, the extended table metadata table name, and the tenant ID number, indicating that the operation is to perform an inner join query on the basic table, the extended column metadata table, the extended table, and the extended table metadata table, and the output is all the data information of the tenant.

[0037] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0038] (1) The present invention proposes to use extended columns and extended tables in combination to meet the tenant's data table field extension requirements; the extended table is used to meet the tenant's infinite data table field extension requirements after the extended columns are exhausted; the extended column metadata table and the extended table metadata table are respectively used to store the metadata of the extended column fields and the extended fields in the extended table.

[0039] (2) The database designed by the present invention can meet the infinite data table field extension requirements in the multi-tenant shared data storage mode, improve the database space utilization rate, and enhance the data query efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 is a schematic flowchart of a method for extending data table fields to support multi-tenant shared data storage according to an embodiment of the present invention;

[0041] Figure 2 is a flowchart for extending tenant data table fields according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0042] To describe the present invention more clearly and in detail, the present invention combines extended columns and extended tables in an embodiment to meet the tenant's data table field extension requirements; the extended table is used to meet the tenant's infinite data table field extension requirements after the extended columns are exhausted; the extended column metadata table and the extended table metadata table are respectively used to store the metadata of the extended column fields and the extended fields in the extended table; the data provided by the embodiment proves that the present invention has practical application effects and meets the actual usage requirements. The database designed by the embodiment of the present invention can meet the infinite data table field extension requirements in the multi-tenant shared data storage mode, improve the database space utilization rate, and enhance the data query efficiency. As Figure 1 shown is a schematic flowchart of a method for extending data table fields to support multi-tenant shared data storage according to an embodiment of the present invention.

[0043] The embodiment of the present invention provides a method for extending data table fields to support multi-tenant shared data storage. To prove the applicability of the present invention, it is applied to an example, which specifically includes the following steps:

[0044] S1: Construct the basic table, extended column metadata table, extended table, and extended table metadata table of the tenant;

[0045] Construct a basic table and an extended column metadata table containing extended columns according to the initial business attributes, and then construct an extended table and an extended table metadata table corresponding to the basic table according to the basic table;

[0046] For example, the initial business attributes are "tenantId", "name", and "age". Based on the initial business attributes, a basic table Tenant is constructed and the initial data is inserted, as shown in Table 1, which is used to store tenant information and contains fields such as tenantId, name, age, extColumn1, and extColumn2. Among them, the tenantId, name, and age fields belong to the basic information fields, and the extColumn1 and extColumn2 belong to the extended column fields. The basic information fields are common fields, that is, all tenants have the tenantId, name, and age attributes.

[0047] Table 1 Basic Table of Tenant Information

[0048] tenantId name age extColumn1 extColumn2 A001 A 22 B001 B 23 C001 C 24

[0049] Then, based on the above basic table Tenant, its corresponding extended column metadata table Tenant_cm is constructed, as shown in Table 2:

[0050] Table 2 Extended Column Metadata Table of Tenant Information

[0051] tenantId extColumnName extColumnlable 001 extColumn1 height 001 extColumn2 weight

[0052] Then, based on the above basic table Tenant, its corresponding extended table Tenant_T is constructed, as shown in Table 3:

[0053] Table 3 Extended Table of Tenant Information

[0054] tenantId extColumnId extColumnValue 001 ext001 XX District, Beijing

[0055] Finally, based on the above basic table Tenant, its corresponding extended table Tenant_tm is constructed, as shown in Table 4:

[0056] Table 4 Extended Table Metadata Table of Tenant Information

[0057] tenantId extColumnId lable 001 ext001 address

[0058] S2: Obtain the field extension requirements of the tenant data table;

[0059] As shown in Table 1, when tenant A needs to extend new business attributes and submits a "address" database table field extension request, after the database table field extension request is reviewed and approved, it enters the persistent database table field extension process. If the request is rejected, the extension operation is abandoned.

[0060] S3: Persist the field extension of the data table for storing tenant shared data;

[0061] For the database table field extension requests that have passed the review, they enter the persistent stage.

[0062] As Figure 2 shown in the flowchart of tenant data table field extension, according to the flowchart, when the extension request for the "address" field of tenant A passes the review, first detect the remaining quantity R of the extended columns of tenant A in the basic table t , as shown below

[0063] R t = T(B t , T id );

[0064] In the formula: R t represents the number of extended columns that the tenant has not used in the basic table; T represents the detection function of the remaining quantity of extended columns; B t represents the basic table, and T id represents the tenant ID number;

[0065] The input of the detection function T is the basic table name and the tenant ID number, which represents the operation of querying the remaining quantity of extended columns of the tenant in the basic table through the tenant ID number, and the output is the number of remaining extended columns of the tenant in the basic table;

[0066] As shown in the example of Table 1, the extColumn1 and extColumn2 fields of tenant A are not used. At this time, the R of tenant A t = 2, and tenant A can use the extended column fields in the basic table B t to store its own extended field data. Through the total number N of extended columns and the remaining quantity R of extended columns t it can be calculated that tenant A has not used the extColumn1 field in the basic table B t , that is, select this field to implement the data table field extension of the tenant this time. To use the extended column to implement the data table field extension, first the tenant needs to insert a record in the extended column metadata table to store the extended column metadata, specifically:

[0067] INSERT INTO Tenant_cm(tenantId,extColumnName,extColumnLable)

[0068] VALUES('A001','extColumn1','address');

[0069] The "address" field extension of tenant A is completed. Repeating the above extension process, tenant A can extend the "phone" field again. The basic table and the extended column metadata table after the extension are shown in Table 5 and Table 6

[0070] Table 5 Basic table of tenant A after extension (Tenant)

[0071] tenantId name age extColumn1 extColumn2 A001 A 22 Beijing City 13313023963 B001 B 23 C001 C 24

[0072] Table 6 Extended Column Metadata Table (Tenant_cm) of Tenant A after Extension

[0073] tenantId extColumnName extColumnLable A001 extColumn1 address A001 extColumn2 phone

[0074] S4: Determine the tenant's data information based on the basic table, extended column metadata table, extended table, and extended table metadata table;;

[0075] To determine the tenant's data information, first query the data records of the tenant in the extended table. If there are no data records of the tenant in the extended table, then the tenant's data information is only composed of the records in the basic table and the extended column metadata table, and the tenant's data information can be obtained by performing an inner join query on the basic table and the extended column metadata table. If there are data records of the tenant in the extended table, then the tenant's data information is composed of the records in the basic table, the extended column metadata table, the extended table, and the extended table metadata table, and all the tenant's data information can be obtained by performing an inner join query on the above four tables.

[0076] For Tenant A, at this time, there are no records of Tenant A in the extended table, and its data information is only composed of the records in the basic table and the extended column metadata table. At this time, the first all data information I of Tenant A t1 is:

[0077] I t1 = G1(B t , M cm , T id );

[0078] In the formula: I t1 represents the first all data information of the tenant; G1 represents a function to obtain the tenant's data information from the inner join result of the basic table and the extended column metadata table based on the tenant ID; B t represents the basic table; M cm represents the extended column metadata table; T id represents the tenant ID number;

[0079] The input of the G1 function is the basic table name, the extended column metadata table name, and the tenant ID number, indicating that the operation is to perform an inner join query on the basic table and the extended column metadata table, and the output is all the data information of the tenant. Specifically:

[0080] SELECT *

[0081] FROM Tenant t INNER JOIN Teant_cm tcm ON t.tenantId = tcm.tenantId

[0082] WHERE t.tenantId = 'A001';

[0083] For tenant A, there are five business attributes at this time: tenantId, name, age, "address", and "telephone". The data of "address" and "telephone" attributes are stored in extColumn1 and extColumn2 fields respectively. At this time, the data information of tenant A is: "tenantId", "name", "age", "address", and "telephone". If tenant A needs to expand the "gender" field, repeat step 2. When the expansion request is approved, go to step 3. The process is as above. At this time, tenant A's R t =0, tenant A's extension request needs to be implemented using the extension table.

[0084] Use the extended table to implement data table field expansion. First, add a record to the extended table, specifically:

[0085] INSERT INTO Tenant_T(tenantId,extColumnId,extColumnValue)

[0086] VALUES('A001','ext01','man');

[0087] Then store the metadata of the newly extended field in the extended table metadata table, specifically:

[0088] INSERT INTO Tenant_tm(tenantId,extColumnId,lable)

[0089] VALUES('A001','ext001','Gender');

[0090] At this point, the "Gender" field of tenant A has been expanded. The expanded table and expanded column metadata table after the expansion are shown in Table 7 and Table 8.

[0091] Table 7 Tenant A extended table (Tenant_T)

[0092] tenantId extColumnId extColumnValue A001 ext01 man

[0093] Table 8 Metadata table of the extended table after tenant A is expanded (Tenant_tm)

[0094] tenantId extColumnId lable A001 ext01 gender

[0095] For tenant A, at this time, tenant A has records in the extended table, and its data information is composed of records in the basic table, the extended column metadata table, the extended table, and the extended table metadata table. At this time, tenant A's second all data information I t2 for:

[0096] I t2 = G2(B t , M cm , E t , M tm , T id );

[0097] In the formula: I t2 represents the second all data information of the tenant; G2 represents a function to obtain all data information of the tenant from the join results within the basic table, extended column metadata table, extended table, and extended table metadata table based on the tenant ID; B t represents the basic table; M cm represents the extended column metadata table; E t represents the extended table; M tm represents the extended table metadata table; T id represents the tenant ID number.

[0098] The input of the G2 function is the basic table name, extended column metadata table name, extended table name, extended table metadata table name, and tenant ID number, indicating an inner join query operation on the basic table, extended column metadata table, extended table, and extended table metadata table, and the output is all data information of the tenant. Specifically:

[0099] SELECT *

[0100] FROM Tenant t

[0101] INNER JOIN Teant_cm tcm ON t.tenantId = tcm.tenantId

[0102] INNER JOIN Teant_T tt ON t.tenantId = tt.tenantId

[0103] INNER JOIN Teant_tm ttm ON t.tenantId = ttm.tenantId

[0104] WHERE t.tenantId = 'A001';

[0105] The extension of column data table fields has significant advantages in data query efficiency. However, if the reserved number of extended columns is defined according to the tenant with the largest extension requirement, it will cause a large number of null value problems in the database, greatly reducing the utilization rate of the database space. Too few extended columns cannot meet the data table field extension requirements of all tenants. The extended table can meet the needs of tenants for unlimited data table field extension, but the query efficiency is lower than that of extended columns. The above technical solution combines the use of extended columns and extended tables to achieve the extension of data table fields in the multi-tenant shared data storage mode, improving the utilization rate of the database space and at the same time enhancing the data query efficiency.

[0106] In summary, the prediction results of this case prove to have very good effects.

[0107] (1) The embodiment of the present invention proposes to combine the use of extended columns and extended tables to meet the data table field extension requirements of tenants; the extended table is used after the extended columns are exhausted to meet the infinite extension requirements of tenants' data table fields; the extended column metadata table and the extended table metadata table are respectively used to store the metadata of the extended column fields and the extended fields in the extended table; the data provided by the embodiment proves that the present invention has practical application effects and meets the actual use requirements.

[0108] (2) The database designed by the embodiment of the present invention can meet the infinite extension requirements of data table fields in the multi-tenant shared data storage mode, improve the utilization rate of the database space, and enhance the data query efficiency at the same time. The embodiment further illustrates that the application effect of the present invention is better.

[0109] The embodiments described above are only used to describe the preferred embodiments of the present invention, and do not limit the scope of the present invention. Without departing from the design spirit of the present invention, various deformations and improvements made by those of ordinary skill in the art to the technical solutions of the present invention shall fall within the protection scope determined by the claims of the present invention.

Claims

1. A method for extending data table fields to support multi-tenant shared data storage, characterized in that It includes the following steps: Step 1: Construct the basic table, extended column metadata table, extended table, and extended table metadata table for the tenant; Construct the basic table and extended column metadata table containing extended columns according to the initial business attributes, and construct the corresponding extended table and extended table metadata table based on the basic table; Step 2: Obtain the tenant data table field extension requirements; When the tenant puts forward the requirement for extending the data table fields, the administrator reviews the requirement for extending the data table fields of the tenant. The requirement for extending the data table fields of the tenant that passes the review enters the persistence stage; Step 3: Persist the extension of the data table fields stored in the tenant shared data; For the requirement for extending the data table fields of the tenant that passes the review, detect the remaining number of extended columns of the tenant in the basic table. If the remaining number of extended columns is greater than 0, this extension requirement is implemented using the extended columns in the basic table; if the remaining number of extended columns is equal to 0, this extension requirement is implemented using the extended table. The specific process of persisting the extension of the tenant data table fields is as follows: The extended columns and extended tables are both used to meet the tenant's data table field extension requirements. When the tenant requests a data table field extension, first detect the remaining quantity R of the extended columns in the basic table for the tenant t , as follows: R t = T(B t , T id ); Where: R t represents the number of extended columns not yet used by the tenant in the basic table; T represents the detection function of the remaining number of extended columns; B t represents the basic table, T id represents the tenant's ID number; The input of the detection function T is the basic table name and the tenant ID number, which represents the operation of querying the remaining number of extended columns of the tenant in the basic table through the tenant ID number, and the output is the remaining number of extended columns of the tenant in this basic table; When R t > 0, it means that the remaining number of extended columns of the tenant in the basic table is greater than 0. At this time, the extended columns are used to meet the extended requirements of the tenant, and the metadata of the tenant's extended data is stored in the extended column metadata table to complete the data extension of the tenant; When R t = 0, it means that the remaining number of extended columns of the tenant in the basic table is equal to 0. At this time, the extended table is used to meet the tenant's data table field requirements. First, add a record in the extended table to store the field names extended by the tenant, and then store the metadata of the tenant's extended data in the extended table metadata table to complete the tenant's data extension; Step 4: Determine the tenant's data information based on the basic table, extended column metadata table, extended table, and extended table metadata table; To determine the tenant data information, first query the data records of the tenant in the extended table. If there are no data records of the tenant in the extended table, the tenant's data information is only composed of the records in the basic table and the extended column metadata table, and the tenant data information can be obtained by performing an inner join query on the basic table and the extended column metadata table; If there are data records of the tenant in the extended table, the tenant's data information is composed of the records in the basic table, extended column metadata table, extended table, and extended table metadata table. By performing an inner join query on the above four tables, all the data information of the tenant can be obtained.

2. The method for extending data table fields to support multi-tenant shared data storage according to claim 1, wherein The multi-tenant shared data storage mentioned above means that all tenants share a database and a data table, and the information of all tenants is stored in the same table.

3. The method for extending data table fields for supporting multi-tenant shared data storage according to claim 1, wherein The basic table in Step 1 is specifically: The basic table is different from the conventional basic table. In addition to the basic information fields constructed according to the initial business attributes, it also includes a certain number of extended column fields; the basic information fields are used to directly store the initial business attribute data of the tenant; the extended column fields are used to implement the tenant's data table field extension requirements, and the number of extended columns is determined by the software developer according to the software product characteristics during software design.

4. The method for extending data table fields to support multi-tenant shared data storage according to claim 1, characterized in that, The extended table in Step 1 is specifically: The extended table is an affiliated table associated with the basic table, which is used to meet the infinite extension needs of the tenant after the limited number of extended columns in the basic table are used up; the extended table is used to store at least the following fields: tenant ID field, extended field name field, extended field value field.

5. The method for extending data table fields to support multi-tenant shared data storage according to claim 1, characterized in that, The extended column metadata table and extended table metadata table in Step 1 are specifically: The extended column metadata table and the extended table metadata table are respectively the affiliated tables associated with the basic table and the extended table. The extended column metadata table is used to store the metadata of the extended columns in the basic table; the extended table metadata table is used to store the metadata of the extended attributes in the extended table.

6. The method for extending data table fields for supporting multi-tenant shared data storage according to claim 1, wherein The process of determining the tenant's data information in step 4 is specifically as follows: Determine the tenant data information. First, query the data records of the tenant in the extended table. If there are no data records of the tenant in the extended table, the data information of the tenant is only composed of the records in the basic table and the extended column metadata table. The tenant data information can be obtained by performing an inner join query on the basic table and the extended column metadata table; at this time, the first all data information I of the tenant t1 is as follows: I t1 = G1(B t , M cm , T id ); Where: I t1 represents the first all data information of the tenant; G1 represents the function to obtain the tenant data information from the connection result in the basic table and the extended column metadata table according to the tenant ID; B t represents the basic table; M cm represents the extended column metadata table; T id Indicates the tenant ID number; The input of the G1 function is the basic table name, the extended column metadata table name, and the tenant ID number, indicating that the operation is to perform an inner join query on the basic table and the extended column metadata table, and the output is all the data information of the tenant; If there are data records of the tenant in the extended table, the data information of the tenant consists of records in the basic table, the extended column metadata table, the extended table, and the extended table metadata table. By performing an inner join query on the above four tables, all data information of the tenant can be obtained; at this time, the second all data information I of the tenant t2 is as follows: I t2 = G2(B t , M cm , E t , M tm , T id ); Where: I t2 represents the second all data information of the tenant; G2 represents the function to obtain all data information of the tenant from the joined results in the basic table, extended column metadata table, extended table, and extended table metadata table according to the tenant ID; B t represents the basic table; M cm represents the extended column metadata table; E t represents the extended table; M tm represents the extended table metadata table; T id represents the tenant ID number; The input of the G2 function is the basic table name, the extended column metadata table name, the extended table name, the extended table metadata table name, and the tenant ID number, indicating that the operation is to perform an inner join query operation on the basic table, the extended column metadata table, the extended table, and the extended table metadata table, and the output is all the data information of the tenant.

Citation Information

Patent Citations

  • Method and system for extending database table under multi-tenant environment

    CN102200977A

  • Method for storing structural data of tenants in multi-tenant database

    CN105912597A