Shared storage method and device of heterogeneous database, electronic equipment and storage medium

By receiving and parsing structured query statements for different types of databases, determining the execution plan and optimizing data execution, the problem of sharing storage of different types of databases is solved, and efficient storage sharing and stable database operation is achieved.

CN119690971APending Publication Date: 2025-03-25INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411835615.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-13
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

The prior art is difficult to realize shared storage of different types of databases without data migration.

Method used

By receiving structured query statements sent by database instances, the target syntax parser is determined according to the database type, the statement is parsed, the execution plan is determined, and the data execution plan is optimized through hardware resources to realize shared storage of different types of databases.

Benefits of technology

There is no need for each type of database to build persistent data separately, so that a set of persistent data can be used to provide data to multiple different types of heterogeneous databases, improve storage efficiency, reduce equipment costs, and ensure the continuous and stable operation of the database.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119690971A_ABST
    Figure CN119690971A_ABST
Patent Text Reader

Abstract

The invention discloses a shared storage method and device of a heterogeneous database, electronic equipment and a storage medium, and relates to the database technology, and the method comprises the following steps: receiving a structured query statement sent by a database instance; determining a target grammar parser according to a database type to which the database instance belongs; analyzing the structured query statement according to the target grammar analyzer; determining an execution plan of the structured query statement according to an analysis result; and applying for hardware resources according to the execution plan, and executing the execution plan according to the persistent optimization data through the hardware resources. According to the embodiment of the invention, the structured query statements can be analyzed through the target grammar analyzer, so that the structured query statements adaptive to different types of databases can be analyzed. The persistent data can provide data support for different types of databases, so that the persistent data can provide data for various different types of heterogeneous databases, the storage sharing of the heterogeneous databases is realized, and the storage efficiency is improved.
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 shared storage method, device, electronic device and storage medium for heterogeneous databases. Background Art

[0002] With the development of database technology, there are more and more types of databases. As banking business and industry needs continue to change, the types of databases used will change. In the process of transitioning from one database to another, shared storage with different types of heterogeneous databases is required.

[0003] At present, different types of databases use separate database data storage, and transfer data by migrating existing object definitions and data. However, this method requires a large amount of data migration. How to achieve shared storage of different types of databases without data migration has become an urgent problem to be solved. Summary of the invention

[0004] The present invention provides a method, device, electronic device and storage medium for sharing storage of heterogeneous databases, so as to solve the problem that it is currently impossible to share storage of different types of databases without performing data migration.

[0005] According to one aspect of the present invention, a shared storage method for heterogeneous databases is provided, comprising:

[0006] Receive structured query language (SQL) sent by the database instance;

[0007] Determining a target syntax parser according to the database type to which the database instance belongs; parsing the structured query statement according to the target syntax parser;

[0008] Determining an execution plan of the structured query statement according to the parsing result;

[0009] Hardware resources are requested according to the execution plan, and the execution plan is executed according to the persistent optimization data through the hardware resources.

[0010] According to another aspect of the present invention, there is provided a shared storage device for heterogeneous databases, comprising:

[0011] A syntax parsing module, used for receiving a structured query statement sent by a database instance; determining a target syntax parser according to the database type to which the database instance belongs; and parsing the structured query statement according to the target syntax parser;

[0012] An execution module, used to determine an execution plan of the structured query statement according to the parsing result;

[0013] The execution applies for hardware resources according to the execution plan, and executes the execution plan according to the persistent optimization data through the hardware resources.

[0014] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0015] at least one processor; and

[0016] a memory communicatively connected to the at least one processor; wherein,

[0017] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the shared storage method for heterogeneous databases described in any embodiment of the present invention.

[0018] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the shared storage method for heterogeneous databases described in any embodiment of the present invention when executed.

[0019] The technical solution of the embodiment of the present invention receives a structured query statement sent by a database instance; determines a target syntax parser according to the database type to which the database instance belongs; parses the structured query statement according to the target syntax parser; determines an execution plan for the structured query statement according to the parsing result; applies for hardware resources according to the execution plan, and executes the execution plan according to persistent optimization data through the hardware resources. The technical solution provided by the embodiment of the present invention can parse the structured query statement through the target syntax parser, and parse the structured query statement adapted to different types of databases. After determining the execution plan according to the structured statement, the execution plan is implemented through hardware resources to process the persistent data. Therefore, persistent data can provide data support for different types of databases, without the need to build persistent data for each type of database separately. A set of persistent data is used to provide data for multiple different types of heterogeneous databases, and storage sharing of heterogeneous databases is achieved, thereby improving storage efficiency.

[0020] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0022] Figure 1 It is a schematic diagram of the system architecture of a shared storage method for heterogeneous databases provided by an embodiment of the present invention;

[0023] Figure 2 It is a flow chart of a shared storage method for heterogeneous databases provided by an embodiment of the present invention;

[0024] Figure 3 It is a flow chart of another method for sharing storage of heterogeneous databases provided by an embodiment of the present invention;

[0025] Figure 4 It is a structural schematic diagram of a shared storage device for heterogeneous databases provided by an embodiment of the present invention;

[0026] Figure 5 It is a schematic diagram of the structure of another shared storage device for heterogeneous databases provided by an embodiment of the present invention;

[0027] Figure 6 It is a structural schematic diagram of an electronic device for implementing the shared storage method of heterogeneous databases according to an embodiment of the present invention. DETAILED DESCRIPTION

[0028] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0029] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0030] The information collected by the embodiments of the present invention is information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of relevant data comply with the relevant laws, regulations and standards of relevant countries and regions, take necessary confidentiality measures, do not violate public order and good customs, and provide corresponding operation portals for users to choose to authorize or refuse. Provide users with corresponding operation portals for users to choose to agree or refuse the results of automated decision-making; if the user chooses to refuse, the expert decision-making process will be entered to avoid relevant legal risks and public opinion risks.

[0031] With the development of database technology, there are more and more types of databases. As banking business and industry needs continue to change, the types of databases used will change. In the process of transitioning from one database to another, shared storage with different types of heterogeneous databases is required.

[0032] Currently, different types of databases use separate data storage to build their own databases, and transfer data by migrating existing object definitions and data.

[0033] Specifically, Oracle, Gauss database, and MySQL database belong to two different database types due to their different storage engines. The above two types cannot share a set of data storage and allow Oracle and GaussDB databases to provide data storage services to the outside world at the same time.

[0034] The current solution for shared storage is that Oracle and GaussDB build their own data storage, and then use the migration tool to migrate the existing object definitions and data of one database to the other. Finally, Oracle and GaussDB use the data replication tool to parse the data log files and synchronize the incremental data to the database on the other end.

[0035] However, the above method requires a large amount of data migration. How to achieve shared storage of different types of databases without performing data migration has become an urgent problem to be solved.

[0036] Figure 1 The system architecture diagram provided for the embodiment of the present invention includes a database instance and shared storage. Different types of database instances include a database instance, such as an Oracle database instance, another database instance, such as a GaussDB database instance and / or a MySQL database instance. The shared storage includes a syntax parser, an executor, shared storage physical management, shared storage lock management, shared storage sequence management, shared storage redo logs, and data file storage. The syntax parser is used to parse the structured query language (SQL) of different types of databases to obtain elements such as objects and predicates processed by the SQL statements. The executor is used to select the preferred data table scanning method and the association method between tables according to the above-mentioned parsing results in combination with the data distribution of the table, the data link, and form and implement an execution plan. An execution plan can be corresponding to each SQL statement. Each database instance sends multiple SQL statements to the shared storage each time, and the shared storage transaction management is used to assign transaction numbers to the multiple SQL statements. Shared storage lock management is used to assign the read-write lock of a data row to a transaction. Before the transaction ends, other transactions cannot read or write the data row. Until the transaction ends, the shared storage lock management assigns the read-write lock of the data row to other transactions. Shared storage sequence management is used to assign a sequence number to each data row. The sequence number is shared by instances of different types of databases, so that different types of databases can use a unified row number to read and write data rows. Shared storage redo logs are used to parse the results and record the operations on the data rows that need to be performed each time. When the execution plan fails, the database state is restored to the state where the execution plan is not executed. Re-execute the execution plan or cancel the execution plan. Data file storage is used to persist data. When the execution plan is implemented, the persistent data is read into the cache resources applied for through the processor resources applied for. When the execution plan is successfully completed, the data file storage persists the execution results to the disk.

[0037] Figure 2This is a flow chart of a method for sharing storage of heterogeneous databases provided by an embodiment of the present invention. This embodiment is applicable to the case of providing shared storage for different types of databases, especially for Oracle database instances, GaussDB database instances, and MySQL database instances. The method can be executed by a shared storage device of a heterogeneous database, which can be implemented in the form of hardware and / or software, and can be configured in electronic devices such as personal computers and servers. Figure 2 As shown, the method includes:

[0038] S101: Receive a structured query statement sent by a database instance.

[0039] Oracle database instance, GaussDB database instance and MySQL database instance belong to different database types. Any of the above database instances can send structured query statements to the shared storage end running the application scheme. The structured query statement can be one or more, which is called a group of structured query statements. Each group of structured query statements is regarded as a transaction processing.

[0040] Optionally, receiving a structured query statement sent by a database instance may be implemented as follows:

[0041] Structured query statements sent by database instances of at least two database types are received, where the database instances of the at least two database types use different data types and syntaxes.

[0042] The database instances of the at least two database types may be any two or three of an Oracle database instance, a GaussDB database instance, and a MySQL database instance.

[0043] There are differences in syntax between Oracle database instances, GaussDB database instances, and MySQL database instances, specifically in the Data Definition Language (DDL), partition keys or partitions, and table structure expressions. In addition, different types of database instances differ in transaction processing, user and schema concepts, and data type support.

[0044] Although there are differences among the above three databases, they can all use structured query statements to process data in the databases. Structured query statements sent by database instances of different database types can be received through the network.

[0045] S102: Determine a target syntax parser according to the database type to which the database instance belongs; and parse the structured query statement according to the target syntax parser.

[0046] The target syntax parser parses the structured query statement and obtains the objects, predicates and other elements contained therein as parsing results.

[0047] Optionally, determining the target parser according to the database type to which the database instance belongs can be implemented in the following manner:

[0048] The database type to which the database instance belongs is determined according to the database identifier carried in the structured query statement; and a target syntax parser is determined from a plurality of pre-configured syntax parsers according to the data type.

[0049] Pre-configure multiple parsers, each parser is used to parse structured query statements corresponding to a database type. For example, three parsers can be created for the three types of data mentioned above, respectively, to parse Oracle database, GaussDB database, and MySQL database. You can also create multiple parsers for a database to parse structured query statements sent by multiple database instances in parallel.

[0050] When sending a structured query statement, the database instance carries a database identifier in the data sent. The database type to which the database instance belongs is determined according to the database identifier. The target syntax parser for parsing the structured query statement of the database is determined according to the database type.

[0051] The above implementation can quickly identify the matching target syntax parser according to the database identifier, thereby improving the parsing efficiency of the structured query statement.

[0052] S103: Determine an execution plan for the structured query statement according to the parsing result.

[0053] According to the analysis results, we can know the data distribution, data chain and specific operations of the tables involved in the structured query statement. There can be multiple execution plans for a structured query statement. According to the access method of the data table and the access method of the objects with association relationships, multiple different alternative execution plans can be generated. From the multiple alternative execution plans, the final preferred execution plan can be determined for execution.

[0054] Optionally, determining the execution plan of the structured query statement according to the parsing result may be implemented as follows:

[0055] Determine multiple alternative execution plans for the structured query statement according to the parsing result; and determine a preferred execution plan according to the execution costs of the multiple alternative execution plans.

[0056] After obtaining multiple alternative execution plans, calculate the cost of each execution plan separately. The cost of the execution plan can be calculated based on the number of hardware-level operations included in the execution plan. The execution plan with the lowest cost is determined as the preferred execution plan. In the process of reading data rows from disk to memory, moving from memory to processor, writing data to memory after the processor performs data processing operations, and then writing data back to disk from memory, the hardware-level operations of the disk include processor calculation time and disk read and write time. Summarize the time of all data rows involved in the alternative execution plan to obtain the time required for the alternative execution plan, that is, the overhead. The alternative plan with the shortest time required for the alternative execution plan is determined as the preferred execution plan.

[0057] For example, the cost of convenient table search and index-based search is different. Different data search methods have different costs. The cost can accurately describe the rationality of the alternative execution plan.

[0058] Through the above implementation, it is possible to accurately find an alternative execution plan with the lowest required time, that is, the lowest overhead, from multiple alternative execution plans as the preferred execution plan, thereby improving the execution efficiency of the structured query statement.

[0059] Optionally, determining the execution plan of the structured query statement according to the parsing result may be implemented in the following manner:

[0060] Transaction numbers are configured for multiple received structured query statements; and an execution plan is determined according to the structured query statements having the same transaction number.

[0061] A transaction number is configured for each received multiple structured query statements. A transaction number identifies a transaction. A transaction contains multiple structured query statements, and each structured query statement corresponds to an execution plan. Using transactions as the unit of database content processing can avoid data errors after the same row of data is processed multiple times.

[0062] When multiple structured query statements belonging to the same transaction number update (or modify) the same data row, no error will occur because they belong to the same transaction. The transaction number is a global attribute. Any transaction triggered by a database class instance is assigned a global transaction number, which will not be repeated.

[0063] For example, a data instance (such as an Oracle database instance) has a transfer operation in which user A transfers an amount of X to user B. This transfer operation is transaction a, which includes reducing the amount of X from user A's account and adding the amount of X to user B's account. Another database instance (such as a GaussDB database instance) has another transfer operation in which user A transfers an amount of Y to user C. This transfer operation is transaction b, which includes reducing the amount of Y from user A's account and adding the amount of Y to user C's account. The above two transactions need to reduce the amount of X and the amount of Y from user A's account respectively.

[0064] As two transactions are executed in sequence, for example, transaction A is executed first and then transaction B. If the balance of user A's account is less than X+Y amount, but greater than any amount of X or Y, transaction A is executed successfully, but transaction B fails because the balance of user A's account is insufficient. If transactions are not distinguished, transaction A and transaction B will be executed at the same time, and no error will be reported, resulting in data anomalies.

[0065] The above implementation method can divide database operations by transaction numbers, thereby improving data reading and writing reliability.

[0066] S104: Apply for hardware resources according to the execution plan, and execute the execution plan according to the persistent optimization data through the hardware resources.

[0067] The execution plan needs to be executed through hardware resources. Hardware resources such as processors and memory resources can be applied for according to the time cost and resource requirements of the execution plan. For distributed databases, communication resources such as network bandwidth need to be applied for. The execution plan obtained in step S103 is implemented using the applied hardware resources.

[0068] Optionally, executing the execution plan according to the persistent optimization data by the hardware resources may be implemented in the following manner:

[0069] The execution result of the execution plan is written into the redo log; if an error occurs in the current execution plan, the data is rolled back according to the redo log.

[0070] During the execution of each transaction, multiple structured query statements contained in the transaction may not be fully executed due to network delays or data verification, resulting in transaction failure. At this time, only part of the transaction has been executed, so the data may be incompletely processed. At this time, data recovery is required.

[0071] After each transaction is executed, the execution result of the execution plan, that is, the result of the successful execution of each data row, is recorded in the redo log. Therefore, if an error occurs in the current execution plan, the result of the data row after the last successful execution can be found in the redo log, and the data row can be rewritten according to the result to complete the data rollback.

[0072] The above implementation method can roll back data according to the redo log when an error occurs in the execution plan, thereby improving data reliability.

[0073] Further, executing the execution plan according to the persistent optimization data by the hardware resources also includes:

[0074] The data rows accessed by the execution plan are locked and protected according to the transaction number to which the execution plan belongs; when all execution plans included in the transaction number are executed, the lock protection is released.

[0075] Each data row has a lock. When the lock is assigned to the transaction currently processing the data row, the data row cannot be accessed and processed by other transactions. Until the current transaction is completed, the lock of the data row will be assigned to other transactions, so that a data row can only be accessed by one transaction at a time, thereby improving data reliability.

[0076] Furthermore, a global sequence number is generated for each data row. The row numbers of data rows accessed by different database instances should be consistent. By configuring a global sequence number, problems such as duplicate data access can be avoided, and data access reliability can be improved.

[0077] Furthermore, when all the execution plans corresponding to the transaction are successfully implemented, the execution results are persisted to the disk. The multiple data rows involved in the transaction can be saved in memory, and when the transaction is successfully executed, the execution results are written to the disk in batches to improve the disk throughput.

[0078] The shared storage method of heterogeneous databases in the embodiment of the present invention receives a structured query statement sent by a database instance; determines a target syntax parser according to the database type to which the database instance belongs; parses the structured query statement according to the target syntax parser; determines an execution plan for the structured query statement according to the parsing result; applies for hardware resources according to the execution plan, and executes the execution plan according to persistent optimization data through the hardware resources. The shared storage method of heterogeneous databases provided in the embodiment of the present invention can parse the structured query statement through the target syntax parser, and parse the structured query statement adapted to different types of databases. After determining the execution plan according to the structured statement, the execution plan is implemented through hardware resources to process the persistent data. Therefore, persistent data can provide data support for different types of databases, without the need to build persistent data for each type of database. A set of persistent data is used to provide data for multiple different types of heterogeneous databases, and storage sharing of heterogeneous databases is realized to improve storage efficiency.

[0079] Figure 3 A schematic diagram of a shared storage method for heterogeneous databases according to an embodiment of the present invention includes:

[0080] Step S201: receiving structured query statements sent by database instances of at least two database types, where the database instances of the at least two database types use different data types and syntaxes.

[0081] Step S202: determining the database type to which the database instance belongs according to the database identifier carried in the structured query statement; and determining a target syntax parser from a plurality of pre-configured syntax parsers according to the data type.

[0082] Step S203: configuring transaction numbers for the received multiple structured query statements; and determining alternative execution plans according to the structured query statements with the same transaction number.

[0083] Step S204: determine multiple alternative execution plans for the structured query statement according to the parsing result; and determine a preferred execution plan according to the execution costs of the multiple alternative execution plans.

[0084] Step S205: Apply for hardware resources according to the execution plan, generate a global sequence number for each data row, lock and protect the data row accessed by the execution plan according to the transaction number to which the execution plan belongs; when all execution plans included in the transaction number are executed, release the lock protection.

[0085] Step S206: Write the execution result of the execution plan into the redo log; if an error occurs in the current execution plan, roll back the data according to the redo log.

[0086] The shared storage method of heterogeneous databases in the embodiment of the present invention receives a structured query statement sent by a database instance; determines a target syntax parser according to the database type to which the database instance belongs; parses the structured query statement according to the target syntax parser; determines an execution plan of the structured query statement according to the parsing result; applies for hardware resources according to the execution plan, and executes the execution plan according to persistent optimization data through the hardware resources. The shared storage method of heterogeneous databases provided in the embodiment of the present invention can parse the structured query statement through the target syntax parser, and parse the structured query statement adapted to different types of databases. After determining the execution plan according to the structured statement, the execution plan is implemented through hardware resources to process the persistent data. Therefore, persistent data can provide data support for different types of databases, without the need to build persistent data for each type of database. A set of persistent data is used to provide data for multiple different types of heterogeneous databases, realize storage sharing of heterogeneous databases, and improve storage efficiency. In addition, different types of database instances can share a set of data storage, without consuming more storage resources, and reducing equipment costs. Without the need to use a data replication tool, the problem of session exhaustion caused by continuous cyclic replication of the data replication tool can be avoided, and different types of databases can be ensured to run continuously and stably. By storing data with a unified global serial number, we can avoid the problem of old data overwriting new data, keep the persistent data of different types of databases consistent, avoid the problem of different query results in different databases, and improve data storage reliability.

[0087] Figure 4 This is a schematic diagram of the structure of a shared storage device for heterogeneous databases provided by an embodiment of the present invention. This embodiment is applicable to the case of providing shared storage for different types of databases, especially for Oracle database instances, GaussDB database instances, and MySQL database instances. The method can be executed by a shared storage device for heterogeneous databases, which can be implemented in the form of hardware and / or software, and can be configured in electronic devices such as personal computers and servers. Figure 4 As shown, the device includes: a grammar parsing module 31 and an execution module 32.

[0088] The syntax parsing module 31 is used to receive a structured query statement sent by a database instance; determine a target syntax parser according to the database type to which the database instance belongs; and parse the structured query statement according to the target syntax parser;

[0089] The execution module 32 is used to determine the execution plan of the structured query statement according to the parsing result; apply for hardware resources according to the execution plan, and execute the execution plan according to the persistent optimization data through the hardware resources.

[0090] Based on the above embodiment, optionally, the grammar parsing module 31 is used to:

[0091] Determining the database type to which the database instance belongs according to the database identifier carried in the structured query statement;

[0092] A target syntax parser is determined from a plurality of pre-configured syntax parsers according to the data type.

[0093] like Figure 5 As shown, based on the above embodiment, optionally, a transaction management module 33 is further included, and the transaction management module 33 is used to:

[0094] Configure transaction numbers for multiple received structured query statements;

[0095] Determine the execution plan based on structured query statements with the same transaction number.

[0096] Based on the above embodiment, optionally, a redo log module 34 is further included, and the redo log module 34 is used to:

[0097] Write the execution results of the execution plan to the redo log;

[0098] If an error occurs in the current execution plan, the data is rolled back according to the redo log.

[0099] Based on the above embodiment, optionally, a lock management module 35 is further included, and the lock management module 35 is used to:

[0100] Lock and protect the data rows accessed by the execution plan according to the transaction number to which the execution plan belongs;

[0101] When all execution plans included in the transaction number are executed, the lock protection is released.

[0102] Based on the above embodiment, optionally, the execution module 32 is used to:

[0103] Determining multiple alternative execution plans for the structured query statement according to the parsing result;

[0104] A preferred execution plan is determined according to the execution costs of the multiple alternative execution plans.

[0105] Based on the above embodiment, optionally, the grammar parsing module 31 is used to:

[0106] Structured query statements sent by database instances of at least two database types are received, where the database instances of the at least two database types use different data types and syntaxes.

[0107] The shared storage device of the heterogeneous database of the embodiment of the present invention, the syntax parsing module 31, is used to receive the structured query statement sent by the database instance; determine the target syntax parser according to the database type to which the database instance belongs; parse the structured query statement according to the target syntax parser; the execution module 32 is used to determine the execution plan of the structured query statement according to the parsing result; apply for hardware resources according to the execution plan, and execute the execution plan according to the persistent optimization data through the hardware resources. The shared storage device of the heterogeneous database provided by the embodiment of the present invention can parse the structured query statement through the target syntax parser, and realize the parsing of the structured query statement adapted to different types of databases. After determining the execution plan according to the structured statement, the execution plan is implemented through the hardware resources to process the persistent data. Therefore, the persistent data can provide data support for different types of databases, and there is no need to build persistent data for each type of database separately. A set of persistent data is used to provide data for multiple different types of heterogeneous databases, realize storage sharing of heterogeneous databases, and improve storage efficiency.

[0108] The shared storage device for heterogeneous databases provided in the embodiment of the present invention can execute the shared storage method for heterogeneous databases provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0109] Figure 6 1 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. The electronic device 10 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0110] like Figure 6As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0111] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0112] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a shared storage method for heterogeneous databases.

[0113] In some embodiments, the shared storage method of heterogeneous databases may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the shared storage method of heterogeneous databases described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the shared storage method of heterogeneous databases in any other appropriate manner (e.g., by means of firmware).

[0114] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0115] The computer program for implementing the shared storage method of heterogeneous databases of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general-purpose computer, a special-purpose computer or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or the block diagram are implemented. The computer program can be executed completely on the machine, partially on the machine, partially on the machine and partially on a remote machine as an independent software package, or completely on a remote machine or server.

[0116] The embodiment of the invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to execute a shared storage method for heterogeneous databases, the method comprising:

[0117] Receive structured query statements sent by the database instance;

[0118] Determining a target syntax parser according to the database type to which the database instance belongs; parsing the structured query statement according to the target syntax parser;

[0119] Determining an execution plan of the structured query statement according to the parsing result;

[0120] Apply for hardware resources according to the execution plan, and execute the execution plan according to the persistent optimization data through the hardware resources.

[0121] Based on the above embodiment, optionally, determining a target syntax analyzer according to a database type to which the database instance belongs includes:

[0122] Determining the database type to which the database instance belongs according to the database identifier carried in the structured query statement;

[0123] A target syntax parser is determined from a plurality of pre-configured syntax parsers according to the data type.

[0124] Based on the above embodiment, optionally, determining the execution plan of the structured query statement according to the parsing result includes:

[0125] Configure transaction numbers for multiple received structured query statements;

[0126] Determine the execution plan based on structured query statements with the same transaction number.

[0127] Based on the above embodiment, optionally, executing the execution plan according to the persistent optimization data by using the hardware resources includes:

[0128] Write the execution results of the execution plan to the redo log;

[0129] If an error occurs in the current execution plan, the data is rolled back according to the redo log.

[0130] Based on the above embodiment, optionally, executing the execution plan according to the persistent optimization data by the hardware resources further includes:

[0131] Lock and protect the data rows accessed by the execution plan according to the transaction number to which the execution plan belongs;

[0132] When all execution plans included in the transaction number are executed, the lock protection is released.

[0133] Based on the above embodiment, optionally, determining the execution plan of the structured query statement according to the parsing result includes:

[0134] Determining multiple alternative execution plans for the structured query statement according to the parsing result;

[0135] A preferred execution plan is determined according to the execution costs of the multiple alternative execution plans.

[0136] Based on the above embodiment, optionally, receiving a structured query statement sent by a database instance includes:

[0137] Structured query statements sent by database instances of at least two database types are received, where the database instances of the at least two database types use different data types and syntaxes.

[0138] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, 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), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0139] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0140] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0141] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0142] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0143] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A shared storage method for heterogeneous databases, characterized in that: include: Receive structured query statements sent by the database instance; Determine a target syntax parser according to the database type to which the database instance belongs; Parsing the structured query statement according to the target syntax parser; Determining an execution plan of the structured query statement according to the parsing result; Hardware resources are requested according to the execution plan, and the execution plan is executed according to the persistent optimization data through the hardware resources.

2. The method according to claim 1, characterized in that Determining a target syntax parser according to the database type to which the database instance belongs includes: Determining the database type to which the database instance belongs according to the database identifier carried in the structured query statement; A target syntax parser is determined from a plurality of pre-configured syntax parsers according to the data type.

3. The method according to claim 1, characterized in that: Determining an execution plan of the structured query statement according to the parsing result includes: Configure transaction numbers for multiple received structured query statements; Determine the execution plan based on structured query statements with the same transaction number.

4. The method according to claim 3, characterized in that Executing the execution plan according to the persistent optimization data by the hardware resources includes: Write the execution results of the execution plan to the redo log; If an error occurs in the current execution plan, the data is rolled back according to the redo log.

5. The method according to claim 3, characterized in that: Executing the execution plan according to the persistent optimization data by the hardware resources also includes: Lock and protect the data rows accessed by the execution plan according to the transaction number to which the execution plan belongs; When all execution plans included in the transaction number are executed, the lock protection is released.

6. The method according to claim 1, characterized in that Determining an execution plan of the structured query statement according to the parsing result includes: Determining multiple alternative execution plans for the structured query statement according to the parsing result; A preferred execution plan is determined according to the execution costs of the multiple alternative execution plans.

7. The method according to claim 1, characterized in that Receive structured query statements sent by the database instance, including: Structured query statements sent by database instances of at least two database types are received, where the database instances of the at least two database types use different data types and syntaxes.

8. A shared storage device for heterogeneous databases, characterized in that: include: A syntax parsing module, used for receiving structured query statements sent by a database instance; Determine a target syntax parser according to the database type to which the database instance belongs; Parsing the structured query statement according to the target syntax parser; The execution module is used to determine the execution plan of the structured query statement according to the parsing result; apply for hardware resources according to the execution plan, and execute the execution plan according to the persistent optimization data through the hardware resources.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the shared storage method for heterogeneous databases according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the shared storage method for heterogeneous databases according to any one of claims 1 to 7 when executed.