Processing data in database systems
By introducing centralized cache and unique identifier management between database systems, the problem of low operating efficiency of independent database systems in the data lake is solved, achieving efficient utilization of resources and avoiding repeated calculations.
Patent Information
- Application Number
- CN202080060773.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-25
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2040-08-25
AI Technical Summary
The existing independent database system has low operating efficiency in the data lake and lacks effective resource management and result sharing mechanisms, resulting in repeated calculations and resource waste.
By introducing a centralized cache between database systems, manage table versions using unique identifiers, and distribute processing and retrieval costs between database systems and caches, deciding whether to process results locally or retrieve them from cache.
It effectively saves the processing resources of the database system, avoids repeated calculations, and improves the efficiency of data processing and resource utilization.
Smart Images

Figure CN114286988B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of digital computer systems, and more particularly, to a method for processing data in a database system. Background Art
[0002] A data lake is a system where many types of data can be stored in a common platform, making it possible to manage, combine, and analyze it using a common toolset. Data lakes are often formed by a federation of independent systems that can run on multiple different sites, such as across hybrid or multi-cloud. Typically, these independent systems are relational database systems that execute on the same or similar data sets. However, there is a need to improve the operation of these independent systems. Summary of the invention
[0003] Various embodiments as described in the subject matter of the independent claims provide a method for processing data of a database system, a cache system and a computer program product. Advantageous embodiments are described in the dependent claims. If the embodiments of the invention are not mutually exclusive, they can be freely combined with each other.
[0004] In one aspect, the present disclosure relates to a method for processing data of a database system, the database system being configured to be connected to a centralized cache (or cache) shared with other database systems. The database system is configured to be connected to the cache. The method includes receiving a request for processing data of at least one table of the database system. Determining a unique identifier of a version of the table using a public identification method of the database system. Generating a database command for processing the table, the command referencing the identifier. Determining whether the cache includes a result of the same command with the same identifier. Processing the command at the database system or retrieving the result of the command from the cache depending on whether the cache includes the result.
[0005] In another aspect, the present disclosure relates to a method for processing data of a database system, the database system being configured to be connected to a centralized cache shared with other database systems. The method includes receiving a request for processing data of a plurality of tables of the database system. For each of the plurality of tables, a unique identifier of a version of the table is determined using a public identification method of the database system. A database command for processing data of the plurality of tables is generated, the command referencing a plurality of identifiers. The command is decomposed into a plurality of subcommands, which independently process tables of the plurality of tables. It is determined whether the cache includes the result of the same instruction or the result of each subcommand. In the case where the subcommand and the result of the command do not exist in the cache, the generated command is processed. In the case where the result of the generated command does not exist in the cache and the result of at least one subcommand exists in the cache: at least one subcommand is processed or its result is retrieved from the cache; the subcommand whose result does not exist in the cache is processed; the results of the subcommands are merged according to the command to obtain the result of the command. In the case where the result of the generated command exists in the cache, the command is processed or its result is retrieved from the cache.
[0006] In another aspect, the present disclosure relates to a computer program product, which includes a computer-readable storage medium having a computer-readable program code, wherein the computer-readable program code is configured to implement the method according to the aforementioned embodiment.
[0007] On the other hand, the present disclosure relates to a system, comprising: a database system configured to be connected to a centralized cache shared with other database systems; one or more processors; and a computer-readable storage medium coupled to the one or more processors, storing program instructions that, when executed by the one or more processors, cause the one or more processors to perform a method according to the aforementioned embodiment.
[0008] The above summary is not intended to describe each illustrated embodiment or every implementation of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] The accompanying drawings included in this application are incorporated into the specification and form a part of the specification. They show embodiments of the present disclosure and are used to explain the principles of the present disclosure together with the specification. The accompanying drawings only illustrate certain embodiments and do not limit the present disclosure.
[0010] Figure 1 Depicted is a block diagram of a computer system for accessing data stored in multiple databases, according to an embodiment.
[0011] Figure 2 is a flowchart of a method for processing data of a database system according to an embodiment.
[0012] Figure 3A is a flowchart of a method for processing data of a database system according to an embodiment.
[0013] Figure 3B is a block diagram of a lookup table of query results according to an embodiment.
[0014] Figure 4 A computerized system suitable for implementing one or more method steps according to an embodiment is represented.
[0015] Figure 5 is a flowchart of a method for processing data of a database system according to an embodiment. DETAILED DESCRIPTION
[0016] The description of various embodiments of the present invention will be presented for the purpose of illustration, but is not intended to be exhaustive or limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terms used herein are selected to best explain the principles of the embodiments, practical applications, or technical improvements existing in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
[0017] The subject matter of the present invention can save processing resources in a database system by using centralized query memorization between a group of independent database systems. The subject matter of the present invention provides a distributed cache so that partial results can be shared between database systems. This can prevent recalculation of previously processed queries. This can be particularly advantageous in a data lake. For example, a database system and other database systems can be part of a data lake.
[0018] For example, each database system in the database system is configured to store the results of each query executed in the database system in a cache in association with a description of the query. For example, each entry in the cache can be associated with a query executed in a corresponding database system of the database system, where the entry can include a description of the query, an identifier of a table referenced in the query, and the results of the query. The common identification method of the database system is a function used by each database system to generate a unique identifier from the contents of a table. The method described herein can be performed by each database system in the database system.
[0019] The centralized cache may be, for example, a distributed cache that spans multiple servers so that its size and transaction capacity can grow.Each database system may be configured to remotely connect to the centralized cache.
[0020] The version of a table is the current or last version of a table at a database system. The version of a table may be a unique version name or a unique version number that uniquely identifies the contents (or state) of the table.
[0021] According to an embodiment, the method further comprises comparing a processing cost of processing the command by the database system with a retrieval cost of retrieving the result from the cache to the database system, and performing processing of the command at the database system or retrieving the result of the command from the cache based on the comparison result. These embodiments may enable a cost check to be performed on the database command, wherein the result of the cost check indicates whether the processing cost of the database command is higher than the cost of retrieving the result of the database command from the cache.
[0022] For example, a query planner at a database system receives an indication of which subqueries have been computed and are present in the cache, and then makes a local decision to determine whether the estimated cost of locally delivering the results exceeds the estimated cost of recomputing the subqueries present in the cache.
[0023] The processing cost and the retrieval cost may refer to the amount of processing resources such as CPU and network bandwidth. The processing cost and the retrieval cost may have normalized values, for example, in the interval [0, 1]. Depending on the task to be performed, the cost may be estimated by identifying the processing resources involved in the task. For example, for data transmission over a network, the resources may be network bandwidth, CPU, memory, etc. The cost may be estimated using those identified resources, and the resulting cost may be normalized so that it may be compared to other costs for different tasks.
[0024] These embodiments may be advantageous because it may save processing resources in the database system compared to other database systems that always recalculate queries without the possibility of retrieving results from a cache.
[0025] According to an embodiment, the method further comprises: receiving a query at the database system; determining, by a query planner of the database system, a query plan for the query, the query plan comprising at least one subquery referencing the table; wherein generating the database command comprises replacing the name of the table with the identifier in the subquery to generate the database command. Replacing the table name with the identifier in the subquery results in a database command.
[0026] If the at least one subquery includes a plurality of subqueries, generation of commands may be performed for each of the plurality of subqueries by replacing the table name in each of the plurality of subqueries with the determined identifier and by determining whether the cache includes results for each of the generated commands. A cost check may be applied to each of the generated database commands. Based on the results of the cost check, each generated command may be processed at the database system or the results of the generated database commands may be retrieved from the cache if they are present in the cache.
[0027] In another example, the present method can be used to process all subqueries of a query plan, i.e., for each different referenced table in a subquery of the query plan, a unique identifier can be determined, and for each subquery of the query plan, a command can be generated by replacing the table name in the subquery with the corresponding identifier. For each generated command, it can be determined whether the corresponding result already exists in the cache. The execution of each command or the import of its result from the cache can be decided based on a cost check. This can achieve a systematic and automatic method. Since each subquery of the query plan is automatically processed, regardless of whether it references a shared table, this can save additional resources that would otherwise be needed to check which queries reference shared tables.
[0028] A query plan (or query execution plan) may be a set of ordered steps for accessing data (e.g., each step may be performed by a subquery). These embodiments may be advantageous because they may be seamlessly integrated into existing systems. Existing query planners may be configured according to the subject matter of the present invention to replace table names with corresponding unique identifiers in subqueries of query plans.
[0029] For example, a query plan includes multiple subqueries sq1, sq2, sq3, and sq4. Subqueries sq1 and sq2 reference a table, and sq3 and sq4 reference a different table. In one example, subqueries sq1 and sq2 that reference the table can be identified. For the tables of sq1 and sq2, a unique identifier can be determined only once, two commands can be generated for sq1 and sq2, and a check can be performed for all generated commands to see whether the cache includes the results. In another example, an identifier can be generated for each different table of subqueries sq1, sq2, sq3, and sq4, four commands can be generated for sq1, sq2, sq3, and sq4, and a check can be performed for all generated commands to see whether the cache includes the results. Processing of each of the four database commands can be performed or their results (if they exist) can be retrieved from the cache based on the results of the cost check of each of the four database commands.
[0030] According to an embodiment, the query plan includes a plurality of sub-queries referencing different tables, and the method further includes identifying at least one sub-query using a name of the table.
[0031] Instead of replacing table names in every subquery in a query plan, you can replace table names only for subqueries that reference tables shared with other database systems. This can save processing resources that would otherwise be required to process all subqueries even though they are not present in the cache.
[0032] According to an embodiment, the query plan includes additional subqueries that reference the table, and the method further includes generating additional database commands for each of the additional subqueries by replacing the name of the table with an identifier in the additional subqueries, and repeating the second determining step and the processing step for each of the additional generated commands. Using the same identifier that is generated only once for all subqueries can save processing resources compared to processing each of the subqueries individually.
[0033] According to an embodiment, the query plan includes additional subqueries that reference different tables of the database system, and the method further includes identifying a subquery that references a table shared with other database systems among the multiple subqueries, and repeating the determination of the identifier for each different table of the different tables, and repeating the generating step, the second determining step and the processing step for each identified subquery.
[0034] For example, a query plan includes multiple subqueries sq1, sq2, sq3, and sq4. Only subqueries sq1, sq2, and sq3 reference tables shared with other database systems. For example, sq1 and sq2 reference the same table, while sq3 references a different table, but the two tables are shared with other database systems. In this case, subqueries sq1, sq2, and sq3 that reference the shared table can be identified, and a unique identifier can be determined only once for the tables of sq1 and sq2, and another unique identifier can be determined for the table of sq3. Three commands can be generated for sq1, sq2, and sq3, and a check on whether the cache includes the results of each generated command can be performed as described herein. The processing of each of the three database commands can be performed or their results (if they exist) can be retrieved from the cache based on the results of the cost check of each of the three database commands.
[0035] According to an embodiment, the method further comprises, before determining the identifier, determining that the table is shared with at least part of other database systems.
[0036] If the table is not shared with other database systems, there may be no need to waste the resources of the query cache because queries that reference the table are not present in the cache. The table is shared with other database systems meaning that the other database systems include the table. The last version of the table in each database system may be the same or different.
[0037] According to an embodiment, the identifier of the table is determined using an ID table to map the table name to a corresponding unique identifier, eg, the identifier is read or retrieved from the ID table.
[0038] The ID table can map a table name to a unique identifier, such as a UUID, which is derived from the content of the corresponding table with the table name. The unique identifier can be calculated from the data itself, for example, by applying a hash. For example, the ID table can be a centralized table accessible by different database systems. This can enable the generation of IDs in a centralized manner. For example, the ID table can be generated by a single system for each database system. In another example, the ID table can be a universal version table that exists at each database system of the database system. Therefore, each independent database system can maintain the ID table independently of every other database system.
[0039] According to one embodiment, the method further comprises determining the identifier, comprising applying a hash function to the current contents of the table to generate the identifier. The table may have different versions. The current contents of the table may be the last version of the table. This may be advantageous because it enables consistent data processing results to be achieved between independent database systems such as database systems.
[0040] According to an embodiment, the cache includes a lookup table having a text description of the query as a key and a result of the query as a value, wherein determining whether the cache includes the result of a command includes creating a text description of the command and querying the lookup table using the text description.
[0041] According to an embodiment, the value of the lookup table is a representation of a materialized query table (MQT) table. In one example, the value of the lookup table can be a link or reference to a parquet file that includes the MQT. This can enable seamless integration of the method in an existing system. For example, the method can utilize the infrastructure that creates the MQT for generating cached content. This can save processing resources that would otherwise be required to build the system from scratch.
[0042] According to an embodiment, the database system includes additional tables, and the method further includes repeating the method for one or more of the additional tables. For example, if another request for processing another table is received, a unique identifier can be created from the other table, a command can be generated for the received request, the command references the unique identifier, and the second determining step and the processing or retrieving step can be repeated for the generated command.
[0043] According to an embodiment, the receiving of the request is performed before or after determining the unique identifier. Determining the unique identifier before receiving the request can speed up the process of executing the request because the unique identifier has already been prepared. Determining the unique identifier after receiving the request can save processing resources that would otherwise be needed to determine the unique identifier of the table that was not requested.
[0044] Figure 1 1 is a block diagram of a computer system 100 for accessing data stored in multiple databases according to an embodiment. The computer system 100 includes multiple database systems 101A-N. Each of the database systems 101A-N can be, for example, a relational database system such as DB2, Oracle, and MySQL systems.
[0045] Each of the database systems 101A-N may include respective data tables. For example, the database system 101A includes tables Ta1 ... TaN. The database system 101B includes tables Ta1, Tb1 ... TbN, and the database system 101N includes tables Tn1 ... TnN. Figure 1 As shown, database systems 101A-B share the same table Ta1. Tables of database systems 101A-N may be updated periodically, sporadically, or occasionally, meaning that a version is associated with each table. Each of the tables in database systems 101A-N may have a version number indicating its current content. Each database system 101A-N executes a set of queries on the latest version of the table present on the system. For example, although database systems 101A-B share the same table Ta1, it may happen that they include different versions of the table Ta1.
[0046] For example, each of the database systems 101A-N includes an ID generation module 105. The ID generation module 105 can be configured to generate a unique ID using a common identification method, for example. For example, the ID generation module 105 can be configured to receive input data and generate a unique identifier from the input data. Since it exists in each database system 101A-N, the ID generation module 105 can enable the IDs in the database systems 101A-N to be generated in a consistent manner. For example, if the same version of table Ta1 exists in database systems 101A and 101B, the ID generated from Ta1 in each database system 101A-B is the same.
[0047] In another example, in addition to or alternatively to the ID generation module 105, an ID table may be provided in each database system 101A-N, which maps a unique identifier to a table name of a table of the corresponding database system. The unique identifier of the ID table may be determined, for example, by the ID generation module 105 or by another system using a public identification method.
[0048] Each of the database systems 101A-N may include a query planner 107A-N. Each of the query planners 107A-N may be configured to determine a query plan for each received query at the corresponding database system 101A-N. For example, the query planner may decompose a received non-trivial query into a set of sub-queries. The sub-queries may then be scheduled and executed so that independent sub-queries may be executed in parallel.
[0049] For example, a query Q1 received at database system 101A, such as ; can be decomposed by the query planner 107A into a sub-query Q1_1 that selects rows from table Ta1 and a sub-query Q1_2 that selects rows from Ta2 before performing a JOIN. In another example, a query Q2 is received at the database system 101B, such as: ; can be decomposed by the query planner 107B into one subquery Q2_1 that selects rows from table Ta1 and one subquery Q2_2 that selects rows from Tb3 before performing the JOIN. This results in the two query plans including the same subqueries, i.e., the first subquery Q1_1 of query Q1 is the same as the first subquery Q2_1 of query Q2. By memorizing the result of the first subquery of one of the two query plans, it can be reused by the other query plan, thereby avoiding a large amount of computation at the computer system 100. To this end, each database system can use a materialized query table (MQT) 109A-N stored locally in each database system 101A-N. For example, a process of the database system can measure how frequently queries and subqueries are executed and create MQTs locally in the database system. Each MQT 109A-N stores the results of queries executed in the corresponding database system. In addition, in order to reuse the results in the MQT (e.g., 109A) calculated on the database system (e.g., 101A) by another database system 101B-N, a centralized cache 103 is provided in the computer system 100 for storing the results of the MQT. Each of the database systems 101A-N may be configured to be connected to the centralized cache 103. The connection may include, for example, a direct connection, a bus connection, a local area network (LAN) connection, an Internet connection, a combination thereof, and the like.
[0050] The centralized cache system 103 can enable memory of the results 120 of queries executed at each database system 101A-N. This can allow partial results of a computation to be stored so that other computations can automatically use those partial results without having to recompute them. For example, the cache 103 can include a mapping of the MQTs 109A-N and the corresponding queries. The cache 103 can consist of a lookup table having the text of the query as a key and a representation of the MQT as a value. The text of the query can include a unique identifier referenced in the query. This can be advantageous for the following reasons. On a database system, there is limited storage, so the benefits of keeping the MQTs may need to be weighed against the cost of storage. An advantage of the subject matter of the present invention is that the distributed cache can be arbitrarily large, meaning that the MQTs do not need to be removed frequently. For example, each time a query is submitted, the query planner determines a standard query plan, but also determines a query plan that replaces the table name with the corresponding UUID. This can result in an extended query plan. The subqueries of the expanded query plan can then be submitted to the centralized cache, where a text lookup is performed to see if a corresponding subquery already exists, because the text description of the subquery contains a UUID rather than a table name, so it is universally unique. In one example, each of the database systems 101A-N can be configured to generate text descriptions of the queries using the same text description generation method used by cache 103 to create the lookup table. The database system can use those text descriptions to query the cache. In another example, the database system can send the generated query to the cache, and the cache can generate a text description of the received query before performing a search in the lookup table to determine that there are results for the query stored at the cache.
[0051] Figure 2 1 is a flowchart of a method for processing data of a database system according to an embodiment. For exemplary purposes only, reference is made to the database system 101A and Table Ta1 for description. Figure 2 , but it can be performed by any one of the database systems 101A-N and other tables.
[0052] For example, Figure 2 The method can be automatically executed when a request to process table Ta1 is received at database system 101A. In another example, once table Ta1 is stored or changed, Figure 2 In another example, Figure 2 The method may be automatically executed periodically, and the database system 101A may be configured to check new or changed tables of the database system 101A every hour or every day, and when a change or new table Ta1 is detected, the method may be executed on the changed table Ta1 or the new table Ta1.
[0053] In step 201, a unique identifier (ID1) of the contents of the table Ta1 may be determined using a universal identification method of the database systems 101A-N. For example, the ID generation module 105 may generate a unique ID from the contents of the table Ta1. To this end, a hash function may be applied to the current contents of the table Ta1 (the last version of Ta1) to generate a unique identifier. The unique identifier of the table Ta1 may be a hash value generated from the table Ta1 by the hash function. This may be advantageous because the data of the table Ta1 present in another database system may generate the same hash value.
[0054] In another example, the unique identifier ID1 may be read from an ID table of the database system 101 A. The unique identifier ID1 may be an identifier of an ID table associated with a table name, which is the table name of the table Ta1.
[0055] In step 203, a database command may be generated or determined by the database system 101A to process the data of the table Ta1. The database command may reference the unique identifier of step 201 to indicate the table Ta1. The database command may use, for example, the following SQL statement: In one example, the database command may be automatically generated using the content of the received request. In another example, the database command may be a copy of a predefined command to be regularly executed on newly stored data or changed data, e.g., once Ta1 is stored, the predefined command may be executed, e.g., after the unique ID of the table is inserted into the command.
[0056] Before deciding to execute the generated database command, database system 101A may determine in query step 205 whether cache 103 includes the result of the same command with the same identifier ID1. Since database system 101B also includes table Ta1, it may happen that the same command has already been executed on database system 101B and its result may have been stored in cache 103 according to the subject matter of the present invention.
[0057] If there is no result of the generated database command at cache 103 , the database command may be processed or executed in step 209 at database system 101A.
[0058] If the result of the generated database command exists at cache 103 , then in query step 207 it may be determined whether the processing cost of database system 101A processing the command is higher than the retrieval cost of transferring the result from cache 103 to database system 101A.
[0059] If the processing cost of processing the command by database system 101A is higher than the retrieval cost of transferring the result from cache 103 , the result of the command may be retrieved from the cache in step 211 ; otherwise, command processing at the database system of step 209 may be performed.
[0060] Figure 3A 1 is a flowchart of a method for processing data of a database system according to an embodiment. For exemplary purposes only, reference is made to the database system 101A and Table Ta1 for description. Figure 3A , but it can be performed by any one of the database systems 101A-N and other tables.
[0061] In step 301, a query may be received at database system 101A. The query may be, for example, as follows: .
[0062] At step 303, the query planner 107A may determine a query plan for the received query. For example, a query received from a Ta1 internal node Ta2 It can be decomposed into a sub-query Q1_1 by the query planner 107A: , which selects rows from table Ta1 and a subquery Q1_2: , which selects rows from Ta2 before performing a JION.
[0063] In step 305, at least some of the subqueries of the query plan may be processed so as to replace at least some of the table names of the subqueries with their respective unique identifiers. Step 305 may be performed for each subquery of the query plan. This may prevent further selection checks. In another example, only subqueries that reference tables shared with other database systems 101A-N may be processed to replace their table names. This may save processing resources that would otherwise be needed to request cached query results for tables that are not shared (and therefore not cached). In this example, only subquery Q1_1 references table Ta1 that is shared between two database systems 101A-B.
[0064] Therefore, according to the above example, the subquery Q1_1 can be processed to replace the table name Ta1 with the unique identifier ID1. The unique identifier ID1 can be generated using the ID generation module 105. In another example, the ID table of the database system 101A can be used to read ID1 from the ID table. The processed subquery Q1_1 can be as follows: .
[0065] In step 307, cache 103 may be checked to determine whether the result of the processed subquery of step 305 already exists in cache 103. According to the above example, it may be determined that the subquery The result is stored in cache 103.
[0066] To do this, you can use Figure 3B The cache 103 shown includes a lookup table 323 of the query. The lookup table 323 includes a text description 325 of the query as a key and a result 327 of the query as a value. For example, the cache is composed of a lookup table having the text of the query as a key and a representation of the MQT as a value. For example, one representation of the MQT is a parquet file. This can enable query results, such as a representation of the MQT, to be maintained within a distributed cache with a universal unique key. The text description 325 also indicates a unique identifier of the table of the corresponding query. Determining whether the cache includes the result of the command includes creating a text description of the processed subquery and querying the lookup table 323 using the created text description. According to the above example, the subquery can be created The text description of the subquery can be searched for in the lookup table 323. The text description of the subquery contains the unique identifier ID1.
[0067] Query planner 107A of database system 101A receives an indication of which subqueries have been calculated and are present in cache 103. The results found in cache 103 may be loaded from cache 103 by database system 101A in step 309. The loaded results may become local MQTs. This process involves replacing identifiers (e.g., UUIDs) with corresponding table names.
[0068] Figure 4 A general purpose computerized system 400 is shown, such as database system 101A, suitable for implementing method steps according to an embodiment.
[0069] It should be understood that the methods described herein are at least partially non-interactive and automated by a computerized system such as a server or embedded system. However, in an exemplary embodiment, the methods described herein can be implemented in (partial) interactive systems. These methods can also be implemented in software 412, 422 (including firmware 422), hardware (processor) 405 or a combination thereof. In an exemplary embodiment, the methods described herein are implemented in software as an executable program and are executed by a dedicated or general-purpose digital computer such as a personal computer, workstation, minicomputer or mainframe computer. Therefore, the most general system 400 includes a general-purpose computer 401.
[0070] In an exemplary embodiment, in terms of hardware architecture, Figure 4As shown, computer 401 includes processor 405, memory (main memory) 110 coupled to memory controller 415, and one or more input and / or output (I / O) devices (or peripheral devices) 10, 445 communicatively coupled via local input / output controller 435. Input / output controller 435 can be but not limited to one or more buses or other wired or wireless connections, as known in the art. Input / output controller 435 can have additional elements, such as controller, buffer (cache), driver, repeater and receiver, to achieve communication, which are omitted for simplicity. In addition, the local interface can include address, control and / or data connection, so that appropriate communication can be performed between the above components. As described herein, I / O device 10, 445 can generally include any universal encryption card or smart card known in the art.
[0071] Processor 405 is a hardware device for executing software, particularly software stored in memory 410. Processor 405 may be any custom or commercially available processor, a central processing unit (CPU), a secondary processor among several processors associated with computer 401, a semiconductor-based microprocessor (in the form of a microchip or chipset), a macroprocessor, or generally any device for executing software instructions.
[0072] The memory 410 may include any one or combination of volatile memory elements (e.g., random access memory (RAM, such as DRAM, SRAM, SDRAM, etc.)) and non-volatile memory elements (e.g., ROM, erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM)), and note that the memory 410 may have a distributed architecture in which various components are remote from each other but can be accessed by the processor 405.
[0073] The software in the memory 410 may include one or more separate programs, each of which includes an ordered list of executable instructions for implementing logical functions (particularly the functions involved in the embodiments of the present invention). Figure 4 In the example of , the software in memory 410 includes instructions 412, such as instructions for managing a database, such as a database management system.
[0074] The software in memory 410 also typically includes a suitable operating system (OS) 111. OS 411 essentially controls the execution of other computer programs, such as possible software 412 for implementing the methods described herein.
[0075] The methods described herein may be in the form of a source program 412, an executable program 412 (object code), a script, or any other entity that includes a set of instructions to be executed 412. When a source program, then the program needs to be translated via a compiler, assembler, interpreter, etc., which may or may not be included in the memory 410, in order to operate correctly in conjunction with the OS 411. In addition, the methods may be written in an object-oriented programming language with data classes and method classes, or a procedural programming language with routines, subroutines, and / or functions.
[0076] In an exemplary embodiment, a conventional keyboard 450 and a mouse 455 may be coupled to the input / output controller 435. Other output devices such as the I / O device 445 may include input devices such as, but not limited to, printers, scanners, microphones, etc. Finally, the I / O devices 10, 445 may also include devices that communicate with both input and output such as, but not limited to, a network interface card (NIC) or a modulator / demodulator (for accessing other files, devices, systems, or networks), a radio frequency (RF) or other transceiver, a telephone interface, a bridge, a router, etc. The I / O device 10, 445 may be any common encryption card or smart card known in the art. The system 400 may also include a display controller 425 coupled to the display 430. In an exemplary embodiment, the system 400 may also include a network interface for coupling to a network 465. The network 465 may be an IP-based network for communication between the computer 401 and any external servers, clients, etc. via a broadband connection. The network 465 sends and receives data between the computer 401 and the external system 30, which may be involved in performing some or all of the steps of the method discussed herein. In an exemplary embodiment, network 165 may be a managed IP network managed by a service provider. Network 165 may be implemented wirelessly, for example using wireless protocols and technologies such as WiFi, WiMax, etc. Network 465 may also be a packet-switched network, such as a local area network, a wide area network, a metropolitan area network, the Internet, or other similar types of network environments. Network 465 may be a fixed wireless network, a wireless local area network (LAN), a wireless wide area network (WAN), a personal area network (PAN), a virtual private network (VPN), an intranet, or other suitable network system, and include devices for receiving and sending signals.
[0077] If the computer 401 is a PC, workstation, smart device, etc., the software in the memory 410 may also include a basic input and output system (BIOS) 422. The BIOS is a set of basic software routines that initialize and test the hardware at startup, start the OS 411, and support data transfer between hardware devices. The BIOS is stored in ROM so that the BIOS can be executed when the computer 401 is activated.
[0078] When the computer 401 is in operation, the processor 405 is configured to execute software 412 stored in the memory 410, transfer data to and from the memory 410, and generally control the operation of the computer 401 according to the software. The methods described herein and the OS 411, in whole or in part, but typically the latter, are read by the processor 405, possibly buffered within the processor 405, and then executed.
[0079] When the systems and methods described herein are implemented in software 412, such as Figure 4 As shown, the method can be stored on any computer-readable medium, such as storage device 420, for use by or in conjunction with any computer-related system or method. Storage device 420 may include disk storage such as HDD storage.
[0080] Figure 5 is a flow chart of a method for processing data of a database system according to an embodiment.The database system is configured to connect to a centralized cache shared with other database systems.
[0081] In step 501 , a request for processing data of a plurality of tables (eg, DT1 and DT2 ) of a database system is received.
[0082] In step 503, a unique identifier for a version of each of the plurality of tables may be determined using a common identification method of the database system. This may, for example, result in unique identifiers ID_DT1 and ID_DT2 for tables DT1 and DT2, respectively.
[0083] In step 505, a database command for processing data of multiple tables may be generated. The generated command references the multiple unique identifiers determined in step 503. For example, the database command may reference ID_DT1 and ID_DT2, for example, the database command may require: .
[0084] In step 507, it may be determined whether the cache includes results for at least a portion of the same generated command.
[0085] The determination of step 507 may include decomposing the generated command into multiple sub-commands, which process the data of multiple tables independently. According to the above example, the two sub-commands may be as follows: .
[0086] Determining step 507 includes determining whether a result of the exact same command exists in the cache, and / or determining whether a result of each subcommand exists in the cache.
[0087] In step 509 , a decision may be made to process the command at the database system and / or retrieve the results of the command from the cache based on whether the cache includes at least a portion of the results.
[0088] For example, if the subcommand and the result of the command do not exist in the cache, the generated command may be processed in step 509 .
[0089] If the result of the generated instruction does not exist in the cache and the result of at least one sub-instruction exists in the cache, the at least one sub-instruction may be processed or its result may be retrieved from the cache. Processing at least one sub-command or retrieving the result of at least one sub-command may be performed, for example, based on the result of the cost check of at least one sub-command. In addition, sub-commands whose results do not exist in the cache are processed locally in the database system; and the results of the sub-commands are combined or used according to the command to obtain the result of the command. According to the above example, if two sub-commands are obtained and The result can be used to perform a JOIN operation broken down into two subcommands. The command is .
[0090] In case the result of the generated command is present in the cache, the command may be processed locally at the database system or its result may be retrieved from the cache.Processing the command or retrieving the result of the command may be performed, for example, based on the result of a cost check on the command.
[0091] Various embodiments are specified in the following numbered clauses.
[0092] 1. A method for processing data of a database system, the database system being configured to be connected to a centralized cache shared with other database systems; the method comprising: receiving a request for processing data of at least one table of the database system; determining a unique identifier of a version of the table using a public identification method of the database system; generating a database command for processing data of the table, the command referencing the identifier; determining whether the cache includes a result of the same command with the same identifier; processing the command at the database system or retrieving the result of the command from the cache depending on whether the cache includes the result.
[0093] 2. The method of clause 1, further comprising comparing a processing cost of processing the command by the database system with a retrieval cost of retrieving the result from the cache, and based on the comparison result, performing processing of the command at the database system or retrieving the result of the command from the cache.
[0094] 3. The method as described in any of the preceding clauses further comprises: receiving a query at the database system; determining, by a query planner of the database system, a query plan for the query, the query plan comprising a subquery referencing the table; wherein the generated database command is generated by replacing the name of the table with an identifier in the subquery.
[0095] 4. The method of clause 3, wherein the query plan includes multiple subqueries referencing different tables, and the method further includes identifying the subqueries using the names of the tables.
[0096] 5. The method of clause 3, wherein the query plan includes additional subqueries that reference the table, the method further comprising generating additional database commands for each of the additional subqueries by replacing the name of the table with an identifier in the additional subqueries, and repeating the second determining step and the processing step for each of the additional generated commands.
[0097] 6. The method of clause 3, wherein the query plan includes additional subqueries that reference different tables of the database system, the method further comprising identifying, in the additional subqueries, subqueries that reference tables shared with other database systems; repeating for each different table referenced in the identified subqueries, and repeating the generating step, the second determining step, and the processing step for each identified subquery.
[0098] 7. The method of any preceding clause, further comprising determining, before determining the identifier, that the table is shared with at least a portion of another database system.
[0099] 8. A method according to any of the preceding clauses, wherein the identifier of the table is determined using an ID table that maps table names to corresponding unique identifiers.
[0100] 9. The method of any of the preceding clauses, wherein determining the identifier comprises applying a hash function to the current contents of the table for generating the identifier.
[0101] 10. According to the method described in any of the preceding clauses, the cache includes a lookup table having a text description of a query as a keyword and a result of the query as a value, wherein determining whether the cache includes the result of the command includes creating a text description of the command and using the text description to query the lookup table.
[0102] 11. The method of any preceding clause, the database system comprising further tables, the method further comprising repeating the method for one or more of the further tables.
[0103] 12. The method according to any of the preceding clauses, wherein receiving the request is performed before or after determining the unique identifier.
[0104] 13. A computer program product comprising a computer-readable storage medium having computer-readable program code embodied therein, the computer-readable program code being configured to implement the steps of the method according to clause 1.
[0105] 14. A database system configured to connect to a centralized cache shared with other database systems, the database system configured to receive a request to process data of at least one table of the database system; determine a unique identifier of a version of the table using a public identification method of the database system; generate a database command for processing the data of the table, the command referencing the identifier; determine whether the cache includes a result of the same command with the same identifier; process the command at the database system or retrieve the result of the command from the cache depending on whether the cache includes the result.
[0106] 15. A cache system configured to receive a query description and corresponding results of the query from one or more database systems, the cache system configured to store a mapping of the received query description in association with the results of the query.
[0107] 16. According to the cache system according to claim 15, the mapping is stored in a lookup table, the lookup table has a text description of the query as a keyword and the result of the query as a value, and the cache system is configured to: in response to receiving a request indicating a text description of a command from a database system, query the lookup table using the text description, and return the result of the query to the database system.
[0108] 17. A computer system comprising the database system described in Article 14 and the cache system described in Article 16.
[0109] 18. A method for processing data of a database system, the database system being configured to be connected to a centralized cache shared with other database systems; the method comprising: receiving a request to process data of a plurality of tables of the database system; for each of the plurality of tables, determining a unique identifier of a version of the table using a public identification method of the database system; generating a database command for processing data of the plurality of tables, the command referencing the plurality of identifiers; decomposing the command into a plurality of subcommands, the plurality of subcommands independently processing a table of the plurality of tables; determining whether the cache contains results of the same instruction or results of each subcommand; in the case where the subcommands and the results of the commands are not present in the cache, processing the generated command; in the case where the results of the generated command are not present in the cache and the results of at least one subcommand are present in the cache: processing at least one subcommand or retrieving its results from the cache, processing the subcommand whose results are not present in the cache, and merging the results of the subcommands according to the command to obtain the results of the command; and in the case where the results of the generated command are present in the cache, processing the command or retrieving its results from the cache.
[0110] Various aspects of the present invention are described herein with reference to the flow chart and / or block diagram of the method, device (system) and computer program product according to embodiments of the present invention. It will be understood that each frame of the flow chart and / or block diagram and the combination of frames in the flow chart and / or block diagram can be implemented by computer-readable program instructions.
[0111] The present invention may be a system, method and / or computer program product. The computer program product may include a computer-readable storage medium (or multiple media) having computer-readable program instructions thereon, the computer-readable program instructions being used to cause a processor to perform various aspects of the present invention.
[0112] A computer-readable storage medium may be a tangible device capable of retaining and storing instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. A non-exhaustive list of more specific examples of computer-readable storage media includes 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 disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device such as a punch card or a raised structure in a groove with instructions recorded thereon, and any suitable combination of the foregoing. As used herein, a computer-readable storage medium should not be interpreted as a temporary signal itself, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagated by a waveguide or other transmission medium (e.g., a light pulse by an optical fiber cable), or an electrical signal transmitted by a wire.
[0113] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to a corresponding computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical transmission fibers, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions to be stored in a computer-readable storage medium within the corresponding computing / processing device.
[0114] The computer-readable program instructions for performing the operation of the present invention can be assembly instructions, instruction set architecture (ISA) instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages (such as Smalltalk, C++, etc.) and conventional procedural programming languages (such as "C" programming language or similar programming languages). The computer-readable program instructions can be executed completely on the user's computer, partially on the user's computer, executed as an independent software package, partially on the user's computer and partially on a remote computer, or completely on a remote computer or server. In the latter case, the remote computer can 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 can be connected to an external computer (for example, using an Internet service provider through the Internet). In certain embodiments, in order to perform various aspects of the present invention, the electronic circuit including, for example, a programmable logic circuit, a field programmable gate array (FPGA) or a programmable logic array (PLA) can execute the computer-readable program instructions to personalize the electronic circuit by utilizing the state information of the computer-readable program instructions.
[0115] Various aspects of the present invention are described herein with reference to the flow chart and / or block diagram of the method, device (system) and computer program product according to embodiments of the present invention. It will be understood that each frame of the flow chart and / or block diagram and the combination of frames in the flow chart and / or block diagram can be implemented by computer-readable program instructions.
[0116] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device create a device for implementing the functions / actions specified in one or more boxes of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium, which can guide the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable storage medium having the instructions stored therein includes an article of manufacture, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes of the flowchart and / or block diagram.
[0117] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus, or other device to generate a computer-implemented process, so that the instructions executed on the computer, other programmable apparatus, or other device implement the functions / actions specified in one or more boxes of the flowchart and / or block diagram.
[0118] Flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention.In this regard, each frame in flow chart or block diagram can represent the module, segment or part of instruction, and it comprises one or more executable instructions for realizing the specified logical function.In some alternative embodiments, the function mentioned in the frame may not occur in the order mentioned in the figure.For example, two frames shown continuously can actually be realized as a step, and are performed simultaneously, substantially simultaneously, in a mode of partial or full time overlap, or these frames can sometimes be performed in reverse order, depending on the function involved.It will also be noted that the combination of the frames in each frame of block diagram and / or flow chart illustration and block diagram and / or flow chart illustration can be realized by the dedicated hardware-based system that performs the specified function or action or performs the combination of special hardware and computer instruction.
[0119] The description of various embodiments of the present disclosure has been presented for illustrative purposes, but is not intended to be exhaustive or limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terms used herein are selected to explain the principles of the embodiments, practical applications, or technical improvements existing in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A method for processing data of a first database system, the first database system being configured to be connected to a centralized cache shared with other independent database systems, wherein each of the first database system and the other independent database systems independently processes commands on independent data stored locally within their respective independent database systems, the method comprising: The first database system receives a request for processing data in a table of the first database system; Determining, by the first database system, a unique identifier of the version of the table using a common identification method of the first database system and the other independent databases; generating, by the first database system, a database command for processing data of the table, the command referencing the identifier; determining, by the first database system, whether the cache includes results of the same command having the same identifier, wherein the cache includes results of commands processed by the other independent database system that are retrievable by the first database system; as well as The command is processed at the first database system by the first database system or the result of the command is retrieved from the cache based on whether the cache includes the result.
2. The method according to claim 1, further comprising: comparing a processing cost of processing the command by the first database system to a retrieval cost of retrieving the result from the cache, wherein processing the command or retrieving the result is further based on a result of the comparison, wherein in response to the cache including the result and the retrieval cost exceeds the processing cost, processing the command locally in the first database system rather than retrieving the result from the cache.
3. The method of claim 1 , wherein the first database system includes additional tables, the method further comprising repeating the receiving, determining the unique identifier, the generating, determining whether the cache includes results of the same command with the same identifier, and the processing for one or more of the additional tables. The method of claim 1 , wherein receiving the request is performed before determining the unique identifier. The method of claim 1 , wherein receiving the request is performed after determining the unique identifier.
6. The method according to claim 1, further comprising: receiving a query at the first database system; as well as A query plan for the query is determined by a query planner of the first database system, the query plan including a subquery referencing the table, wherein the generated database command is generated by replacing the name of the table with the identifier in the subquery. 7 . The method of claim 6 , wherein the query plan includes a plurality of subqueries referencing different tables, the method further comprising identifying the subqueries using names of the tables.
8. A method according to claim 6, wherein the query plan includes additional sub-queries that reference the table, the method further comprising generating additional database commands for each of the additional sub-queries by replacing the name of the table with the identifier in the additional sub-queries, and for each of the additional generated commands, repeatedly determining whether the cache includes results of the same command with the same identifier and the processing.
9. The method of claim 6, wherein the query plan includes additional subqueries referencing different tables of the first database system, the method further comprising: identifying, in further subqueries, subqueries that reference tables located in both other database systems and one or more of the first database system; Repeating determining the unique identifier for each distinct one of the tables referenced in the identified subquery; as well as The generating, determining whether the cache includes results for the same command having the same identifier, and the processing are repeated for each identified sub-query.
10. The method of claim 1, further comprising determining, before determining the identifier, that at least one of the other independent database systems contains the table.
11. The method of claim 1, wherein the identifier of the table is determined by using an ID table that maps table names to corresponding unique identifiers.
12. The method of claim 1, wherein determining the identifier comprises applying a hash function to current contents of the table for generating the identifier.
13. A method according to claim 1, wherein the cache includes a lookup table having a text description of a query as a keyword and a result of the query as a value, wherein determining whether the cache includes the result of the command includes creating a text description of the command and querying the lookup table using the text description.
14. A computer program product for processing data of a first database system, the first database system being configured to be connected to a centralized cache shared with other independent database systems, wherein the first database system and each of the other independent database systems independently processes commands on independent data stored locally within their respective independent database systems, the computer program product comprising computer readable program code executable by a processor to cause the processor to perform a method comprising: receiving a request to process data in a table of the first database system; Determine a unique identifier of the version of the table using a common identification method of the first database system and the other independent databases; generating a database command for processing data of the table, the command referencing the identifier; determining whether the cache includes results of the same command having the same identifier, wherein the cache includes results of commands processed by the other independent database system that are retrievable by the first database system; as well as The command is processed at the first database system or the result of the command is retrieved from the cache based on whether the cache includes the result.
15. The computer program product of claim 14, wherein the method further comprises: comparing a processing cost of processing the command by the first database system to a retrieval cost of retrieving the result from the cache, wherein processing the command or retrieving the result is further based on a result of the comparison, wherein in response to the cache including the result and the retrieval cost exceeds the processing cost, processing the command locally in the first database system rather than retrieving the result from the cache.
16. The computer program product of claim 14, wherein the method further comprises: receiving a query at the first database system; as well as A query plan for the query is determined by a query planner of the first database system, the query plan including a subquery referencing the table, wherein the generated database command is generated by replacing the name of the table with the identifier in the subquery.
17. A system comprising: a first database system configured to connect to a centralized cache shared with other independent database systems, wherein the first database system and each of the other independent database systems independently process commands on independent data stored locally within their respective independent database systems; one or more processors; as well as A computer-readable storage medium, coupled to the one or more processors, storing program instructions that, when executed by the one or more processors, cause the one or more processors to perform a method comprising the following steps: receiving a request for processing data in a table of the first database system; Determine a unique identifier of the version of the table using a common identification method of the first database system and the other independent databases; generating a database command for processing data of the table, the command referencing the identifier; determining whether the cache includes results of the same command having the same identifier, wherein the cache includes results of commands processed by the other independent database system that are retrievable by the first database system; as well as The command is processed at the first database system or the result of the command is retrieved from the cache based on whether the cache includes the result.
18. The system of claim 17, wherein the method further comprises: comparing a processing cost of processing the command by the first database system to a retrieval cost of retrieving the result from the cache, wherein processing the command or retrieving the result is further based on a result of the comparison, wherein in response to the cache including the result and the retrieval cost exceeds the processing cost, processing the command locally in the first database system rather than retrieving the result from the cache.
19. The system of claim 17, wherein the method further comprises: receiving a query at the first database system; as well as A query plan for the query is determined by a query planner of the first database system, the query plan including a subquery referencing the table, wherein the generated database command is generated by replacing the name of the table with the identifier in the subquery.
20. A method for processing data of a database system, a first database system being configured to be connected to a centralized cache shared with other independent database systems, the method comprising: receiving a request for processing data in a plurality of tables of the first database system; For each of the plurality of tables, determining a unique identifier of a version of the table using a common identification method of the first database system and the other independent databases; generating a database command for processing data of the plurality of tables, the command referencing the plurality of identifiers; Decomposing the command into a plurality of sub-commands, the plurality of sub-commands independently processing a table among the plurality of tables; determining whether the cache contains results of the same instruction or results of each sub-instruction, wherein the cache includes results of commands processed by the other independent database system that can be retrieved by the first database system; processing the generated command in the event that the subcommand and the result of the command are not present in the cache; In case there is no result of the generated command in the cache and there is a result of at least one sub-command in the cache: processing said at least one subcommand or retrieving its result from said cache, processing subcommands whose results are not present in the cache, and Merge the results of the subcommands according to the command to obtain a result of the command; as well as In case the result of the generated command is present in the cache, the command is processed or its result is retrieved from the cache.
Citation Information
Patent Citations
Method of querying relational database management systems
CN101178727A
Dynamic hash table for efficient data access in relational database system
CN102362273A
Caching electronic document resources in a client device having an electronic resource database
CN102985921A
Self describing configuration with support for sharing data tables
CN108604278A
Cross-tenant data leakage isolation
CN109643358A
