Method, medium, product and device for reading user data across databases

By presetting key system tables and auxiliary system tables in the system database, the meta information of the target user data table is solved, and efficient data reading and physical isolation retention is achieved.

CN119441336BActive Publication Date: 2025-04-01CETC JINCANG (BEIJING) TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510045994.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-13
Publication Date
2025-04-01
Estimated Expiration
2045-01-13

AI Technical Summary

Technical Problem

Existing database technologies cannot implement user data reading across databases, especially when physical isolation is retained.

Method used

By presetting key system tables and auxiliary system tables in the system database, the meta information of the target user data table is obtained, thereby positioning and reading the target user data.

Benefits of technology

It realizes physical isolation of user data across databases without losing performance, meeting user needs while retaining user data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119441336B_ABST
    Figure CN119441336B_ABST
Patent Text Reader

Abstract

The present invention provides a method, medium, product and device for reading user data across databases. The above method includes: obtaining a reading instruction; querying a preset key system table in a system database according to the reading instruction to obtain the first key meta-information corresponding to a target auxiliary system table and the second key meta-information corresponding to a target user table; locating the target auxiliary system table through the first key meta-information corresponding to the target auxiliary system table, and querying the target auxiliary system table to obtain the auxiliary meta-information corresponding to the target user table; locating the target user table according to the second key meta-information and the auxiliary meta-information corresponding to the target user table, and querying the target user table to obtain the target user data. Through this method, the user data can be physically isolated while the data in the user table of other databases can be obtained without losing performance, thereby realizing cross-database user data reading and meeting the needs of users.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of database technology, and in particular to a method, medium, product and device for reading user data across databases. Background Art

[0002] In modern data instances, based on data security and user business needs, most provide a certain degree of data isolation. Mainstream databases provide isolation in both physical and logical dimensions. Physical isolation means that the database data is placed in different physical paths; logical isolation means that the data placed in the same physical path is logically placed in different logical units according to logical rules and certain permissions.

[0003] In current database technology, a session (a link to a database) can generally access logically isolated objects, but cannot access physically isolated objects across databases. Summary of the invention

[0004] In view of the above problems, the present invention proposes a method, medium, product and device for reading user data across databases that overcome the above problems or at least partially solve the above problems.

[0005] An object of the present invention is to implement cross-database user data reading.

[0006] A further object of the present invention is to improve the efficiency of user data query.

[0007] Another further object of the present invention is to select a corresponding query path according to actual needs of the query instruction.

[0008] In particular, the present invention provides a method for reading user data across databases, comprising:

[0009] Get a read instruction, where the read instruction is used to read target user data in a target user database across databases, where the user database is used to record user data;

[0010] According to the read instruction, the preset key system table in the system database is queried to obtain the first key meta-information corresponding to the target auxiliary system table and the second key meta-information corresponding to the target user table. The system database is used to store the preset key system table and the auxiliary system table. The preset key system table is used to store the key meta-information of all data tables. All data tables include all system tables in the system database and all user tables in the user database. The auxiliary system table is used to store the auxiliary meta-information other than the key meta-information corresponding to all data tables.

[0011] The target auxiliary system table is located by using the first key meta information corresponding to the target auxiliary system table, and the auxiliary meta information corresponding to the target user table is obtained by querying the target auxiliary system table;

[0012] The target user table is located according to the second key meta information and the auxiliary meta information corresponding to the target user table, and the target user data is obtained by querying the target user table.

[0013] Optionally, before the step of querying a preset key system table in the system database according to the read instruction to obtain the first key meta-information corresponding to the target auxiliary system table and the second key meta-information corresponding to the target user table, the step further includes:

[0014] Determine whether an auxiliary system table is needed for auxiliary query according to the read instruction;

[0015] If so, the step of querying a preset key system table in the system database according to the read instruction to obtain first key meta-information corresponding to the target auxiliary system table and second key meta-information corresponding to the target user table is executed.

[0016] Optionally, after the step of determining whether an auxiliary system table is needed for auxiliary query according to the reading instruction, the step further includes:

[0017] In the case where the auxiliary system table is not needed for auxiliary query, the second key meta information corresponding to the target user table is obtained by querying the preset key system table according to the read instruction;

[0018] The target user table is located according to the second key meta information, and the target user data is obtained by querying the target user table.

[0019] Optionally, the step of locating the target user table according to the second key meta information includes:

[0020] Obtain path information corresponding to the target user table through the second key meta information;

[0021] The disk path of the target user table is obtained by splicing the path information.

[0022] Optionally, before the step of obtaining the read instruction, the step further includes:

[0023] Read the data of preset key system tables in the system database into the system cache;

[0024] The step of querying a preset key system table in a system database according to a read instruction to obtain first key meta-information corresponding to a target auxiliary system table and second key meta-information corresponding to a target user table is executed in a system cache.

[0025] Optionally, after the step of querying a preset key system table in the system database according to the read instruction to obtain the first key meta-information corresponding to the target auxiliary system table and the second key meta-information corresponding to the target user table, the step further includes:

[0026] The first key metadata corresponding to the target auxiliary system table is stored in the system cache for subsequent query.

[0027] Optionally, the preset key system tables include a table system table, a column system table, and a type system table;

[0028] The table system table is used to store table characteristic information of all data tables, the column system table is used to store column configuration information of all data tables, and the type system table is used to store data type definition information of all data tables.

[0029] According to another aspect of the present invention, a computer program product is provided, which includes a computer program, and when the computer program is executed by a processor, the steps of any one of the above-mentioned methods for reading user data across databases are implemented.

[0030] According to another aspect of the present invention, a computer device is provided, comprising a memory, a processor, and a machine executable program stored in the memory and running on the processor, and the processor implements any of the steps of the above-mentioned cross-database user data reading method when executing the machine executable program.

[0031] The cross-database user data reading method of the present invention first obtains a reading instruction, wherein the reading instruction is used to read the target user data in the target user database across the database, and the user database is used to record the user data; then, according to the reading instruction, the preset key system table in the system database is queried to obtain the first key meta-information corresponding to the target auxiliary system table and the second key meta-information corresponding to the target user table, the system database is used to store the preset key system table and the auxiliary system table, the preset key system table is used to store the key meta-information of all data tables, all data tables include all system tables in the system database and all user tables in the user database, and the auxiliary system table is used to store the auxiliary meta-information other than the key meta-information corresponding to all data tables; then, the target auxiliary system table is located by the first key meta-information corresponding to the target auxiliary system table, and the auxiliary meta-information corresponding to the target user table is queried in the target auxiliary system table; finally, the target user table is located according to the second key meta-information corresponding to the target user table and the auxiliary meta-information, and the target user data is queried by the target user table. Through this method, on the one hand, the physical isolation of user data can be retained, and on the other hand, the data in the user table under other databases can be obtained without losing performance, thereby realizing cross-database user data reading and meeting user needs.

[0032] Furthermore, the cross-database user data reading method of the present invention also reads the data of the preset key system table in the system database into the system cache before reading the data; then executes the step of querying the preset key system table in the system database according to the reading instruction to obtain the first key meta-information corresponding to the target auxiliary system table and the second key meta-information corresponding to the target user table in the system cache; and after the data of the auxiliary system table is needed to be read, the first key meta-information corresponding to the target auxiliary system table is also stored in the system cache for subsequent query. This method can further speed up the efficiency of data query.

[0033] Based on the following detailed description of specific embodiments of the present invention in conjunction with the accompanying drawings, those skilled in the art will become more aware of the above and other objects, advantages and features of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Hereinafter, some specific embodiments of the present invention will be described in detail in an exemplary and non-limiting manner with reference to the accompanying drawings. The same reference numerals in the accompanying drawings indicate the same or similar components or parts. It should be understood by those skilled in the art that these drawings are not necessarily drawn to scale. In the accompanying drawings:

[0035] Figure 1 is a schematic diagram of a database instance architecture according to an embodiment of the present invention;

[0036] Figure 2 is a schematic flow chart of a method for reading user data across databases according to an embodiment of the present invention;

[0037] Figure 3 is a flowchart of a method for reading user data across databases according to another embodiment of the present invention;

[0038] Figure 4 is a schematic diagram of a computer program product according to an embodiment of the present invention;

[0039] Figure 5 is a schematic diagram of a computer-readable storage medium according to an embodiment of the present invention; and

[0040] Figure 6 is a schematic diagram of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0041] It should be understood by those skilled in the art that the embodiments described below are only some embodiments of the present invention, rather than all embodiments of the present invention, and these embodiments are intended to explain the technical principles of the present invention, rather than to limit the protection scope of the present invention. Based on the embodiments provided by the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should still fall within the protection scope of the present invention.

[0042] It should be noted that the logic and / or steps represented in the flowchart or described in other ways herein can be considered as a sequenced list of executable instructions for implementing logical functions, which can be specifically implemented in any computer-readable medium for use by an instruction execution system, device or equipment (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or equipment and execute instructions), or used in combination with these instruction execution systems, devices or equipment.

[0043] In the current database field, some data instances, based on data security and user business needs, mostly provide certain data isolation. Mainstream databases generally provide isolation in both physical and logical dimensions. The so-called physical isolation means that the data in the database is placed in different physical paths; the so-called logical isolation is to follow the logical rules and cooperate with certain permissions to make the data placed in the same physical path logically in different logical units. At present, the physical isolation of mainstream data is achieved through db (database), and the mainstream logical isolation is achieved through schema (mode). Among them, db refers to different databases under the same database instance, which is used to achieve physical isolation of database instances. Schema is different modes under the same db in the same database instance, which is used to achieve logical isolation under db.

[0044] In current database technology, a session (a link to a database) can generally access logically isolated objects, but cannot access physically isolated objects across databases. However, some users need to access data in user tables across both physical units (db) and logical units (schemas). To address such user needs while maintaining physical isolation of data, you first need to be able to obtain which user tables are in other dbs; secondly, you need to know the physical storage location of user tables in other dbs so that you can access user tables in other dbs.

[0045] In order to solve the above problems, the method of the present invention proposes a database architecture such as Figure 1 As shown, Figure 1 Schematic diagram of a database instance architecture according to an embodiment of the present invention. Figure 1It can be seen that the present invention establishes a system database 300 and several user databases, such as user database 410, user database 420, etc., in an established database instance 100. In this embodiment, the system database 300 is generally used to store key system tables and auxiliary system tables. The key system tables are generally used to store key meta-information of all data tables. All data tables include all system tables in the system database and all user tables in the user database, and the auxiliary system tables are used to store auxiliary meta-information other than the key meta-information corresponding to all data tables, that is, the system database 300 is used to store meta-information of all tables in all databases (including the system database itself and the user database), while the user database is only responsible for storing user data tables, and the user data tables are responsible for storing user data.

[0046] Optionally, a key system table 310 and an auxiliary system table are stored in the system database 300, wherein the key system table 310 generally includes three system tables, namely, a table system table 311, a column system table 312, and a type system table 313. The table system table 311 is generally used to store table characteristic information of all data tables, such as the table ID, table name, mode of the table, db where the table is located, disk table space where the table is located, whether it is a system table, and other information of all tables (including system tables and user tables); the column system table 312 is generally used to store column configuration information of all data tables, such as the name, type, length, and other information of each field of all tables (including system tables and user tables); the type system table 313 is generally used to store data type definition information of all data tables, wherein the data type definition information refers to the implementation details of various data types in the database, such as basic information, storage format, value range, and other information of various data types (such as INT, VARCHAR, DATE, etc.). Those skilled in the art can set the specific data types stored in the key system table 310 according to actual conditions. An optional example of the table system table is shown in Table 1:

[0047] Table 1

[0048]

[0049] Among them, table_id represents the data table id, table_name represents the data table name, table_schema represents the data table mode, table_db represents the database where the data table is located, table_space represents the table space where the data table is located, and is_system_table represents whether the data table is a system table.

[0050] An optional example of the column system table is shown in Table 2:

[0051] Table 2

[0052]

[0053] Among them, column_table_id indicates that the data table id of the column corresponds to the table_id in the table system table, column_name indicates the field name of the column, column_type_id indicates the data type of the column, and column_type_id indicates the length of the column.

[0054] An optional example of the type system table is shown in Table 3:

[0055] Table 3

[0056]

[0057] Among them, type_id represents the id of the data type, which corresponds to column_type_id in the column system table, type_name represents the name of the data type, type_in_function represents the specific setting of the input method, and type_out_function represents the specific setting of the output method. The above key system table is only an optional example, and those skilled in the art can determine the specific content of the above key system table according to actual conditions.

[0058] In addition, the auxiliary system tables include auxiliary system table 321, auxiliary system table 322, and auxiliary system table 323, etc. Such auxiliary system tables are generally used to store auxiliary meta-information other than key meta-information corresponding to all data tables, such as the association between each data table and index, the usage of various functions, and the conversion method of different data types, etc. Those skilled in the art can determine the number of auxiliary system tables and the type of auxiliary meta-information actually stored in each auxiliary system table according to actual conditions.

[0059] When the outside world needs to access database instance 100, it generally chooses to create a new session to connect to database instance 100. At this time, if it wants to access user data in other physically isolated databases across databases (that is, access user databases), it can obtain the specific path of the target user data table to be accessed by querying the key system tables and auxiliary system tables of the system database, and then access the corresponding target user data table according to the specific path, and finally query the corresponding user data for the next step.

[0060] In some optional embodiments, in order to improve the query speed, you can also choose to establish a system cache 200. When a new session is established, the data in the key system table 310 is read into the system cache 200. If you need to query the key system table 310, you can directly query it in the system cache 200, thereby reducing the amount of data that needs to be read; if data from other auxiliary system tables is also needed, you can also first query the path information corresponding to the target auxiliary system table through the key system table 310 in the system cache 200, and then locate the target auxiliary system table according to the path information for query, and cache the data of the target auxiliary system table in the system cache 200. If you still need the data of the target auxiliary system table, you can query it in the system cache 200, thereby further reducing the amount of data that needs to be read.

[0061] Through this database architecture, on the one hand, the physical isolation of user data can be maintained, and on the other hand, data in user tables under other databases can be obtained without losing performance, thereby realizing cross-database user data reading and meeting user needs.

[0062] Figure 2 FIG. 1 is a flow chart of a method for reading user data across databases according to an embodiment of the present invention. Figure 2 As shown, the cross-database user data reading method at least includes the following steps S201 to S204.

[0063] Step S201, obtain a read instruction. The read instruction is generally used to read the target user data in the target user database across databases, and the user database is used to record the user data. In this step, the method of obtaining the read instruction can generally be actively input by the user, or automatically generated by the database program due to business needs during operation. Those skilled in the art can decide the method of obtaining the read instruction according to actual conditions.

[0064] Step S202, according to the read instruction, the preset key system table in the system database is queried to obtain the first key meta-information corresponding to the target auxiliary system table and the second key meta-information corresponding to the target user table. The system database is generally used to store the preset key system table and the auxiliary system table, and the preset key system table is generally used to store the key meta-information of all data tables, including all system tables in the system database and all user tables in the user database, and the auxiliary system table is generally used to store the auxiliary meta-information other than the key meta-information corresponding to all data tables.

[0065] In some optional embodiments, the preset key system tables generally include table system tables, column system tables, and type system tables. The table system table is generally used to store table feature information of all data tables, such as table ID, table name, mode of the table, db of the table, disk table space of the table, whether it is a system table, etc. of all tables (including system tables and user tables); the column system table is generally used to store column configuration information of all data tables, such as the name, type, length, etc. of each field of all tables (including system tables and user tables); the type system table is generally used to store data type definition information of all data tables, wherein the data type definition information refers to the implementation details of various data types in the database, such as basic information, storage format, value range, etc. of various data types (such as INT, VARCHAR, DATE, etc.). Those skilled in the art can set the specific data types stored in the key system tables according to actual conditions.

[0066] Auxiliary system tables are generally used to store auxiliary meta-information other than key meta-information corresponding to all data tables, such as the association between each data table and index, the usage of various functions, and the conversion method of different data types. Those skilled in the art can determine the number of auxiliary system tables and the type of auxiliary meta-information actually stored in each auxiliary system table according to actual conditions.

[0067] Step S203: locate the target auxiliary system table through the first key meta-information corresponding to the target auxiliary system table, and query the target auxiliary system table to obtain the auxiliary meta-information corresponding to the target user table.

[0068] In some optional embodiments, since different db storages are physically isolated, to access the data in the user table in other db, it is necessary to be able to read the user table file in other db. This requires that the path of the table file must have certain rules. Therefore, in some optional embodiments, the corresponding disk path of the user db can be: database data directory / user dbid; the disk path of the table pair under the user db can generally be: database data directory / user dbid / user table id; if the user db or user table is set with a special table space, the disk path of the user table can generally be: table space data directory / user dbid / user table id.

[0069] Based on the above design, the corresponding disk path can be obtained by splicing the information about the path in the first key metadata. For example, the table ID, table name, table mode, db, and disk table space of the target auxiliary system table can be queried in the table system table. Then, the path information of the target auxiliary system table can be obtained based on this information, thereby locating the target auxiliary system table.

[0070] Step S204: locate the target user table according to the second key meta-information and the auxiliary meta-information corresponding to the target user table, and obtain the target user data by querying the target user table.

[0071] This method can maintain the physical isolation of user data on the one hand, and on the other hand, obtain data in user tables in other databases without sacrificing performance, thereby realizing cross-database user data reading and meeting user needs.

[0072] In some optional embodiments, before the step of obtaining the first key meta-information corresponding to the target auxiliary system table and the second key meta-information corresponding to the target user table by querying the preset key system table in the system database according to the read instruction, it can generally include: judging whether the auxiliary system table is needed for auxiliary query according to the read instruction; if so, executing the step of obtaining the first key meta-information corresponding to the target auxiliary system table and the second key meta-information corresponding to the target user table by querying the preset key system table in the system database according to the read instruction. The reason for judging whether the auxiliary system table is needed for auxiliary query is that the table characteristic information of all data tables has been stored in the key system table. If the read instruction involves the call of special functions or the conversion of special data types, this information is not in the key system table, but is stored in a specific auxiliary system table. Therefore, it is necessary to query the location information of the target auxiliary system table in the key system table according to the requirements of the read instruction, then locate the target auxiliary system table to obtain the corresponding auxiliary meta-information, then locate the target user table according to the second key meta-information and auxiliary meta-information corresponding to the target user table, and obtain the target user data through the target user table query.

[0073] In other optional embodiments, if the read instruction is only intended to simply query the user data in a certain user data table, no auxiliary meta information is needed. Since the key system table stores the table system table, the column system table, and the type system table, the location information of the target user table can be obtained by splicing according to the content in the key system table. In this case where no auxiliary system table is needed for auxiliary query, the second key meta information corresponding to the target user table can be obtained by querying the preset key system table according to the read instruction; then the target user table is located according to the second key meta information, and the target user data is obtained by querying the target user table.

[0074] Based on the above disk path design, the step of locating the target user table according to the second key meta information can generally include: obtaining the path information corresponding to the target user table through the second key meta information; splicing the disk path of the target user table according to the path information. Since the table system table of the key system table generally stores the table id, table name, mode where the table is located, db where the table is located, disk table space where the table is located, whether it is a system table and other information of all tables, if no auxiliary system table is needed, the table id, table name, mode where the table is located, db where the table is located, disk table space where the table is located and other information of the target user table can be directly searched in the table system table, and then the path information of the target user data table can be spliced ​​according to such information to achieve positioning.

[0075] In some other optional embodiments, before the step of obtaining the read instruction, the following steps may be generally included: reading the data of the preset key system table in the system database into the system cache; executing the step of querying the preset key system table in the system database according to the read instruction to obtain the first key meta-information corresponding to the target auxiliary system table and the second key meta-information corresponding to the target user table in the system cache. After this step, the following steps may generally be included: storing the first key meta-information corresponding to the target auxiliary system table into the system cache for subsequent query. In order to improve the query speed, it is generally possible to choose to read the data in the key system table into the system cache when a new session is established. If the key system table needs to be queried later, the query can be performed directly in the system cache, thereby improving the query speed; if the data of other auxiliary system tables is also needed, the path information corresponding to the target auxiliary system table can also be queried in the system cache through the key system table first, and then the target auxiliary system table is located according to the path information for query, and the data of the target auxiliary system table is cached in the system cache. If the data of the target auxiliary system table is still needed, it can be queried in the system cache.

[0076] Figure 3 FIG. 1 is a flow chart of a method for reading user data across databases according to another embodiment of the present invention. Figure 3 As shown, the cross-database user data reading method at least includes the following steps S301 to S309.

[0077] Step S301, in a new session, read the data of the preset key system table in the system database into the system cache. Reading the data of the key system table into the system cache can reduce the amount of data that needs to be read during the query process, thereby speeding up the query. Among them, the key system tables generally include the table system table, the column system table and the type system table. The table system table is generally used to store the table feature information of all data tables, the column system table is generally used to store the column configuration information of all data tables, and the type system table is generally used to store the data type definition information of all data tables. Those skilled in the art can set the specific data types stored in the key system tables according to actual conditions.

[0078] Step S302, obtaining a read instruction.

[0079] Step S303, determine whether an auxiliary system table is needed for auxiliary query. In some optional embodiments, the read instruction that requires auxiliary query generally means that the instruction needs to convert the data type, and the specific conversion rules are recorded in a certain auxiliary system table, or it is necessary to call certain functions to calculate the data, and the calculation rules of the function are recorded in a certain auxiliary system table. Those skilled in the art can determine the judgment condition that the read instruction needs auxiliary query based on the type of meta-information stored in the key system table and the auxiliary system table.

[0080] Step S304, when the judgment in step S303 is no, the second key meta information corresponding to the target user table is queried in the preset key system table according to the read instruction. If the auxiliary system table is not needed for auxiliary query, the location information of the target user table can be obtained by splicing according to the content in the key system table. Therefore, in this case where the auxiliary system table is not needed for auxiliary query, the second key meta information corresponding to the target user table can be queried in the preset key system table according to the read instruction.

[0081] Step S305, locate the target user table according to the second key meta information, and obtain the target user data through the target user table query. In some optional embodiments, since the table system table of the key system table generally stores the table id, table name, mode where the table is located, db where the table is located, disk table space where the table is located, whether it is a system table and other information of all tables, if no auxiliary system table is needed, the table id, table name, mode where the table is located, db where the table is located, disk table space where the table is located and other information of the target user table can be directly searched in the table system table, so as to obtain the path information of the target user data table according to such information splicing, so as to achieve positioning.

[0082] Step S306, if the judgment in step S303 is yes, the first key meta-information corresponding to the target auxiliary system table and the second key meta-information corresponding to the target user table are queried in the preset key system table in the system cache. The reason for judging whether the auxiliary system table is needed for auxiliary query is that the table characteristic information of all data tables has been stored in the key system table. If the read instruction involves the call of special functions or the conversion of special data types, this information is not in the key system table, but is stored in a specific auxiliary system table. Therefore, it is necessary to query the location information of the target auxiliary system table in the key system table according to the requirements of the read instruction, and then locate the target auxiliary system table to obtain the corresponding auxiliary meta-information, and then locate the target user table according to the second key meta-information and auxiliary meta-information corresponding to the target user table, and obtain the target user data through the target user table query.

[0083] Step S307: store the first key metadata corresponding to the target auxiliary system table into the system cache for subsequent query.

[0084] Step S308: locate the target auxiliary system table through the first key meta-information corresponding to the target auxiliary system table, and query the target auxiliary system table to obtain the auxiliary meta-information corresponding to the target user table.

[0085] Step S309: locate the target user table according to the second key meta-information and the auxiliary meta-information corresponding to the target user table, and obtain the target user data by querying the target user table.

[0086] This method can maintain the physical isolation of user data on the one hand, and on the other hand, obtain data in user tables in other databases without sacrificing performance, thereby realizing cross-database user data reading and meeting user needs.

[0087] The flow chart provided by the present embodiment is not intended to indicate that the operation of the method will be performed in any particular order, or that all operations of the method are included in all every case. In addition, the method may include additional operations. Within the scope of the technical thinking provided by the present embodiment method, additional changes may be made to the above method.

[0088] It should be understood that in some embodiments, each part can be implemented by hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system.

[0089] This embodiment also provides a computer program product 10 , a computer readable storage medium 20 , and a computer device 30 . Figure 4 is a schematic diagram of a computer program product 10 according to an embodiment of the present invention, Figure 5 is a schematic diagram of a computer-readable storage medium 20 according to an embodiment of the present invention, Figure 6 is a schematic diagram of a computer device 30 according to an embodiment of the present invention. The computer program product 10 includes a computer program 11, which implements the steps of any of the above-mentioned methods for reading user data across databases when executed by a processor 32. The computer-readable storage medium 20 stores the above-mentioned computer program 11, which implements the steps of any of the above-mentioned methods for reading user data across databases when executed by a processor 32. The computer device 30 may include a memory 31, a processor 32, and the computer program 11 stored in the memory 31 and running on the processor 32.

[0090] The computer program 11 for performing the operation of the present invention may be an assembly instruction, an instruction set architecture (ISA) instruction, a machine instruction, a machine-related instruction, a microcode, a firmware instruction, a state setting data, a configuration data of an integrated circuit, or a source code or an object code written in any combination of one or more programming languages ​​and process programming languages. The computer program 11 may be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the latter case, the remote computer may be connected to the user's computer through any type of network (including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider through the Internet). In some embodiments, in order to perform various aspects of the present invention, an electronic circuit including, for example, a programmable logic circuit, a field programmable gate array (FPGA) or a programmable logic array (PLA) may execute computer-readable program instructions by utilizing the state information of the computer-readable program instructions to personalize the electronic circuit.

[0091] For the purposes of the description of this embodiment, the computer program product 10 is a related product that includes a computer program 11. For the purposes of the description of this embodiment, the computer-readable storage medium 20 is a tangible device capable of retaining and storing the computer program 11, which may be any device that can contain, store, communicate, propagate or transmit the program 11 for use in or in conjunction with an instruction execution system, device or apparatus. More specific examples (a non-exhaustive list) of the computer-readable storage medium 20 include the following: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, and any suitable combination of the above.

[0092] The computer device 30 may be, for example, a server, a desktop computer, a notebook computer, a tablet computer, or a smart phone. In some examples, the computer device 30 may be a cloud computing node. The computer device 30 may be described in the general context of computer system executable instructions (such as program modules) executed by a computer system. Typically, a program module may include routines, programs, object programs, components, logic, data structures, etc. that perform specific tasks or implement specific abstract data types. The computer device 30 may be implemented in a distributed cloud computing environment where remote processing devices linked through a communication network perform tasks. In a distributed cloud computing environment, program modules may be located on a local or remote computing system storage medium including a storage device.

[0093] The computer device 30 may include a processor 32 adapted to execute stored instructions, and a memory 31 providing temporary storage space for the operation of the instructions during operation. The processor 32 may be a single-core processor, a multi-core processor, a computing cluster, or any number of other configurations. The memory 31 may include a random access memory (RAM), a read-only memory, a flash memory, or any other suitable storage system.

[0094] The computer device 30 may also include a network adapter / interface and an input / output (I / O) interface. The I / O interface allows data to be input and output with external devices that may be connected to the computer device. The network adapter / interface may provide communication between the computer device and a network, which is typically shown as a communication network.

[0095] At this point, those skilled in the art should recognize that, although multiple exemplary embodiments of the present invention have been shown and described in detail herein, many other variations or modifications that conform to the principles of the present invention can still be directly determined or derived based on the content disclosed in the present invention without departing from the spirit and scope of the present invention. Therefore, the scope of the present invention should be understood and recognized as covering all these other variations or modifications.

Claims

1. A method for reading user data across databases, comprising: Obtaining a read instruction, wherein the read instruction is used to read target user data in a target user database across databases, wherein the user database is used to record the user data; According to the read instruction, the preset key system table in the system database is queried to obtain the first key meta-information corresponding to the target auxiliary system table and the second key meta-information corresponding to the target user table, the system database is used to store the preset key system table and the auxiliary system table, the preset key system table is used to store the key meta-information of all data tables, the all data tables include all system tables in the system database and all user tables in the user database, and the auxiliary system table is used to store the auxiliary meta-information other than the key meta-information corresponding to all data tables; Locate the target auxiliary system table by using the first key meta-information corresponding to the target auxiliary system table, and obtain the auxiliary meta-information corresponding to the target user table by querying in the target auxiliary system table; The target user table is located according to the second key meta-information and the auxiliary meta-information corresponding to the target user table, and the target user data is obtained by querying the target user table.

2. The method for reading user data across databases according to claim 1, wherein: Before the step of querying the preset key system table in the system database according to the read instruction to obtain the first key meta-information corresponding to the target auxiliary system table and the second key meta-information corresponding to the target user table, the following step is further included: Determine whether an auxiliary system table is needed for auxiliary query according to the read instruction; If so, the step of querying the preset key system table in the system database according to the read instruction to obtain the first key meta-information corresponding to the target auxiliary system table and the second key meta-information corresponding to the target user table is executed.

3. The method for reading user data across databases according to claim 2, wherein: After the step of determining whether an auxiliary system table is needed for auxiliary query according to the read instruction, the following step further includes: In the case where the auxiliary system table is not needed for auxiliary query, the second key meta information corresponding to the target user table is obtained by querying the preset key system table according to the read instruction; The target user table is located according to the second key meta information, and the target user data is obtained by querying the target user table.

4. The method for reading user data across databases according to claim 3, wherein: The step of locating the target user table according to the second key meta information comprises: Acquire the path information corresponding to the target user table through the second key meta information; The disk path of the target user table is obtained by concatenating the path information.

5. The method for reading user data across databases according to claim 1, wherein: The step of obtaining the read instruction also includes: Reading the data of the preset key system table in the system database into the system cache; The step of querying a preset key system table in a system database according to the read instruction to obtain first key meta-information corresponding to a target auxiliary system table and second key meta-information corresponding to a target user table is executed in the system cache.

6. The method for reading user data across databases according to claim 5, wherein: After the step of querying the preset key system table in the system database according to the read instruction to obtain the first key meta information corresponding to the target auxiliary system table and the second key meta information corresponding to the target user table, the following step further comprises: The first key metadata corresponding to the target auxiliary system table is stored in the system cache for subsequent query.

7. The method for reading user data across databases according to claim 1, wherein: The preset key system tables include table system table, column system table and type system table; The table system table is used to store table characteristic information of all the data tables, the column system table is used to store column configuration information of all the data tables, and the type system table is used to store data type definition information of all the data tables.

8. A computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of the method for reading user data across databases according to any one of claims 1 to 7 are implemented.

9. A computer program product, comprising a computer program, which, when executed by a processor, implements the steps of the method for reading user data across databases according to any one of claims 1 to 7.

10. A computer device comprising a memory, a processor, and a machine executable program stored in the memory and running on the processor, wherein the processor implements the steps of the cross-database user data reading method according to any one of claims 1 to 7 when executing the machine executable program.

Citation Information

Patent Citations

  • Data processing method of database cluster, readable storage medium and equipment

    CN117609375A

  • Query database generation method and device and computer equipment

    CN119166691A