Database management device and method

The database management device improves join processing efficiency by creating filters to limit the scan range of inner tables using column range indexes, addressing performance issues in existing systems.

JP2024126486AActive Publication Date: 2024-09-20HITACHI LTD +1
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
JP2023034882
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Filing Date
2023-03-07
Publication Date
2024-09-20
Estimated Expiration
2043-03-07

AI Technical Summary

Technical Problem

Existing database management systems face performance issues in join processing due to the need to search the entire range of the inner table for each row, especially when no search conditions are given or when the join is not using a partition key, leading to decreased processing efficiency.

Method used

A database management device that performs query processing by creating filters to limit the scan range of inner tables during join operations, utilizing column range indexes to determine the scan range for the next-stage join, thereby reducing the need to search the entire inner table.

Benefits of technology

This approach allows for improved join process performance by limiting the scan range of inner tables regardless of search conditions or the presence of partition keys, enhancing processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2024126486000001
    Figure 2024126486000001
Patent Text Reader

Abstract

To allow for limiting a scan range of an internal table in joint processing regardless of the presence or absence of a search condition or a partition key and to improve performance of the joint processing.SOLUTION: A column range index indicating a range of values stored in a table is provided. In joint of respective stages in joint processing, if a joint result of a present stage becomes an external table related to joint in the next stage, a database management device identifies whether there is the possibility that a hitting row in an internal table related to joint in the present stage is included in an internal table related to joint in the next stage or not on the basis of a column range index corresponding to join columns in the present stage and a column range index corresponding to join columns in the next stage.SELECTED DRAWING: Figure 1
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present invention relates generally to database management, and more particularly to joining tables in a database. [Background technology]

[0002] Regarding the joining of an outer table and an inner table, for example, the techniques disclosed in Patent Document 1 and Non-Patent Documents 1 to 3 are known. Each of Patent Document 1 and Non-Patent Documents 1 to 3 discloses a method of limiting the scan range of the inner table.

[0003] Specifically, for example, Patent Document 1 and Non-Patent Document 3 disclose a method of limiting the scan range of an inner table using a row set of an outer table. Non-Patent Document 2 discloses a method of limiting the scan range using a search condition applied to a join column of an outer table. Non-Patent Document 3 discloses a method of limiting the scan range using a Bloom filter. [Prior art documents] [Patent documents]

[0004] [Patent Document 1] US10,810,20 [Non-patent literature]

[0005] [Non-Patent Document 1] Srikanth Kandula et al., “Pushing Data-Induced Predicates Through Joins in Big-Data Clusters”, VLDB2004 [Non-Patent Document 2] Shinsuke Sugie, "Bloom Filter Algorithm for SQL Execution", October 31, 2016 https: / / future-architect.github.io / articles / 20161031 / [Non-Patent Document 3] Ali Afroozeh et al., “Faster SQL Queries on Delta Lake with Dynamic File Pruning,” April 30, 2020, https: / / www.databricks.com / blog / 2020 / 04 / 30 / faster-sql-queries-on-delta-lake-with-dynamic-file-pruning.html Summary of the Invention [Problem to be solved by the invention]

[0006] According to Patent Document 1 and Non-Patent Document 3, a search of the range of the inner table is required for each row, which reduces the processing performance of the join.

[0007] According to Non-Patent Document 1, if a search condition is not given, the scan range of the inner table cannot be limited.

[0008] According to Non-Patent Document 2, the scan range of the inner table cannot be limited unless the join uses a partition key. Also, according to Non-Patent Document 2, it is necessary to search the corresponding partition for each row, which reduces the processing performance of the join. [Means for solving the problem]

[0009] A database management device performs a query process in response to a query for a database stored in a storage device. When the query process is a process in which a join process including a multi-stage join is performed and, in each stage of the join process, the join result of the current stage becomes an outer table related to the join of the next stage, the database management device performs a filter creation process and scans only the range represented by the filter (data representing the scan range of the inner table) created in the filter creation process, of the inner table related to the join of the next stage. The storage device stores a column range index, which is data representing the range of values ​​stored in a table. The filter creation process includes identifying whether or not the inner table related to the join of the next stage may include a hit row in the inner table related to the join of the current stage, based on a column range index corresponding to the join column of the current stage and a column range index corresponding to the join column of the next stage. Effect of the Invention

[0010] According to the present invention, it is possible to limit the scan range of the inner table in join processing, regardless of the presence or absence of a search condition or a partition key, and it is possible to improve the performance of the join processing. [Brief description of the drawings]

[0011] [Figure 1] 1 shows the configuration of an entire system including a database management device according to a first embodiment. [Diagram 2] The table structure in the database is shown. [Diagram 3] The composition of a column range index is shown below. [Figure 4] An example of recursive join processing is shown below. [Diagram 5] An example of creating a filter in a recursive join process is shown below. [Figure 6A] An example of the case where the scan unit is a segment will be shown. [Figure 6B] An example of a case where the scan unit is a chunk is shown below. [Figure 6C] Below is an example of the case where the scan unit is the entire inner table (no filter is created). [Figure 7] 4 shows the flow of a query process according to the first embodiment. [Figure 8] 4 shows the flow of the next-stage filter creation process. [Figure 9] 4 shows a flow of a creation determination process according to the first embodiment. [Figure 10] 13 shows an example of a multi-stage joining process in the second embodiment. [Figure 11] An example of filter creation in multi-stage combining processing will be shown. [Figure 12] 13 shows the flow of a query process according to the second embodiment. [Figure 13] An example of a data structure in which it is useful to limit the scan range of an inner table in the first or second embodiment will be described. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0012] In the following description, an "interface unit" may refer to one or more interface devices. The one or more interface devices may be at least one of the following: One or more I / O (Input / Output) interface devices. The I / O (Input / Output) interface devices are interface devices to at least one of the I / O devices and a remote display computer. The I / O interface device to the display computer may be a communications interface device. The at least one I / O device may be a user interface device, e.g., either an input device such as a keyboard and a pointing device, or an output device such as a display device. One or more communication interface devices. The one or more communication interface devices may be one or more homogeneous communication interface devices (e.g., one or more NICs (Network Interface Cards)) or two or more heterogeneous communication interface devices (e.g., a NIC and an HBA (Host Bus Adapter)).

[0013] In the following description, a "memory" refers to one or more memory devices, which are an example of one or more storage devices, and may typically be a primary storage device. At least one memory device in the memory may be a volatile memory device or a non-volatile memory device.

[0014] In the following description, a "persistent storage device" may be one or more persistent storage devices, which are an example of one or more persistent storage devices. A persistent storage device may typically be a non-volatile storage device (e.g., an auxiliary storage device), and more specifically, may be, for example, a hard disk drive (HDD), a solid state drive (SSD), or a non-volatile memory express (NVMe) drive.

[0015] Furthermore, in the following description, a "processor" may be one or more processor devices. The at least one processor device may typically be a microprocessor device such as a CPU (Central Processing Unit), but may also be other types of processor devices such as a GPU (Graphics Processing Unit). The at least one processor device may be a single-core or multi-core. The at least one processor device may be a processor core. The at least one processor device may also be a processor device in the broad sense, such as a hardware circuit (e.g., an FPGA (Field-Programmable Gate Array), a CPLD (Complex Programmable Logic Device), or an ASIC (Application Specific Integrated Circuit)) that performs part or all of the processing.

[0016] In the following description, functions may be described using the expression "yyy unit", but the functions may be realized by one or more computer programs being executed by a processor, or by one or more hardware circuits (e.g., FPGA or ASIC), or by a combination thereof. When a function is realized by a program being executed by a processor, the function may be at least a part of the processor, since the specified processing is performed using a storage device and / or an interface device, etc., as appropriate. Processing described with a function as the subject may be processing performed by a processor or a device having the processor. A program may be installed from a program source. The program source may be, for example, a program distribution computer or a storage medium (e.g., a non-transitory storage medium) that can be read by a computer. The description of each function is an example, and multiple functions may be combined into one function, or one function may be divided into multiple functions.

[0017] In addition, in the following description, when describing elements of the same type without distinguishing between them, common reference symbols may be used, and when describing elements of the same type with distinction between them, reference symbols (or element identification numbers) may be used.

[0018] The present invention realizes limiting the scan range of an inner table in a join process. In this specification, the join process is a join process that includes multiple stages of joins, such as a recursive join process or a multi-stage join process, and in the next stage of the join, the outer table is a table based on the result of the previous stage of the join. Several embodiments will be described below. [First embodiment]

[0019] FIG. 1 shows the overall configuration of a system including a database management device according to the first embodiment.

[0020] The database management device 100 includes an interface device 101 , a memory 102 , and a processor 103 .

[0021] The interface device 101 is connected to a communication network (e.g., the Internet) 150. The interface device 101 communicates with the user device 110 and the external storage device 140 via the communication network 150. The user device 110 may be a physical computer such as a personal computer, or a virtual computer based on a physical computer. The interface device 101 may be connected to an input / output device as a user interface device instead of or in addition to the user device 110. That is, the database management device 100 may input and output information between the user device 110 and the input / output device. The communication network to which the database management device 100 and the user device 110 are connected may be different from the communication network to which the database management device 100 and the external storage device 140 are connected.

[0022] The external storage device 140 may be a persistent storage device, a device including a persistent storage device, or online storage. The external storage device 140 stores a database 141. The database 141 includes a table 151 and a column range index 173. The column range index 173 exists for each join column in the table 151, and is index data that indicates the range of the column. The database 141 may be an in-memory database. A "join column" is a column used in a join (a column to be joined).

[0023] The memory 102 stores one or more computer programs. These programs are executed by the processor 103 to implement a DBMS (DataBase Management System) 110. The DBMS 110 has functions such as a query reception unit 111, an optimization unit 112, and a query execution unit 113.

[0024] The query receiving unit 111 receives a query for the database 141 from the user device 110. The query is written in, for example, SQL (Structured Query Language). The user device 110 may be an example of a query source. The query source may be an external device to the database management device 100, such as the user device 110, or may be an internal element of the database management device 100 (for example, an application realized by the processor 103 executing a computer program in a memory).

[0025] The optimization unit 112 may create a query plan required for executing a query based on the query received by the query receiving unit 111. The query plan may be, for example, information including one or more database operators and the execution order relationships of the database operators. The query plan may be represented, for example, as a tree structure in which the database operators are nodes and the execution order relationships of the database operators are edges.

[0026] The optimization unit 112 has a creation determination unit 120. The creation determination unit 120 determines whether or not a filter needs to be created. When the creation determination unit 120 determines that a filter needs to be created, it sets a scan creation flag to "ON". The "scan creation flag" is an example of data indicating whether or not a scan is needed, and is recorded, for example, in the memory 102. The "filter" is data indicating the scan range of an inner table to be scanned in a join. The creation determination unit 120 may be provided outside the optimization unit 112.

[0027] The query execution unit 113 executes a query based on the created query plan and returns the execution result of the query to the user device 110. In executing a query, the query execution unit 113 creates a task for executing a database operator, and executes the created task to issue a read request (or a write request) for data required for the database operator corresponding to the task. The query execution unit 113 may execute multiple database operators in one task. Tasks may be implemented, for example, using processes and kernel threads realized by an OS (Operating System) (not shown), as well as user threads realized by a library or the like.

[0028] Query execution unit 113 includes filter creation unit 130. Filter creation unit 130 creates a filter. Filter creation unit 130 creates a filter when a scan creation flag is "ON." Note that filter creation unit 130 may be provided outside query execution unit 113.

[0029] FIG. 2 shows the structure of table 151 in database 141.

[0030] Table 151 generally has a plurality of rows and a plurality of columns. In this embodiment, table 151 is made up of a plurality of chunks 171. Chunk 171 is made up of a plurality of segments 172. Segment 172 is a unit larger than a row, is made up of a portion of rows (two or more rows) of table 151, and has a plurality of columns that table 151 has.

[0031] The division of table 151 need not be limited to the example shown in FIG. 2. For example, there may be no hierarchy such as chunk 171 larger than segment 172. Also, some of the segments 172 may have some of the columns, and another part of the segments 172 may have another part of the columns (however, at least in the first embodiment, the joined column of the current stage and the joined column of the next stage must exist in the same segment 172). Also, in this embodiment, the size of chunk 171 and the size of segment 172 are uniform, but the size of chunk 171 and / or the size of segment 172 do not need to be uniform. Also, the number of segments 172 that chunk 171 has need not be uniform.

[0032] FIG. 3 shows the composition of the column range index 173.

[0033] As described above, a column range index 173 exists for each join column in table 151. The column range index 173 indicates the range of values ​​of a corresponding column (the column corresponding to the column range index 173), for example, the minimum and maximum values.

[0034] More specifically, column range index 173 has a sub-index 300 for the corresponding column for each chunk 171. For the corresponding chunk (chunk corresponding to sub-index 300) 171, sub-index 300 represents the range of the corresponding column in segment 172 for each segment 172 that the corresponding chunk 171 has. Also, sub-index 300 represents the range of the corresponding column in the corresponding chunk 171 for the corresponding chunk 171.

[0035] In this embodiment, the values ​​in the column are numerical values, and the magnitude of the values ​​is the magnitude of the numerical values, but if the values ​​in the column are values ​​other than numerical values, the magnitude of the values ​​may follow a definition determined by the type of the values. For example, if the values ​​are composed of alphabets, the first letter of the alphabet, "a," may be the minimum value, and the last letter of the alphabet, "z," may be the maximum value.

[0036] In the first embodiment, the join operation is a recursive join operation following a recursive query.

[0037] FIG. 4 shows an example of a recursive join process.

[0038] The filter creation unit 130 creates a filter 400 that represents the inner table scan range in the next join step in a join between an outer table (Left) and an inner table (Right). In the next join step, the table resulting from the previous join step is the outer table. In the join between the outer table and the inner table (next join step), the query execution unit 113 scans only the range represented by the filter 400 in the inner table.

[0039] FIG. 5 shows an example of filter creation in the recursive join process.

[0040] Segment 172 includes both the join column of the current stage and the join column of the next stage. Column range index 173 exists for each of the join column of the current stage and the join column of the next stage. Assume that there are multiple columns A, B, C, .... In FIG. 5, column A is shown as the join column of the current stage, and column B is shown as the join column of the next stage, and therefore column range index 173A for column A and column range index 173B for column B are shown. When the recursive join process proceeds further (when proceeding to the next stage join), the column corresponding to the join column of the current stage and the column corresponding to the column of the next stage may be shifted. Specifically, in the next stage join, column B may be the join column of the current stage, and column C may be the join column of the next stage. In the recursive join process, the join is recursively performed until an outer table cannot be obtained as a join result.

[0041] In the example shown in FIG. 5, the filter creation unit 130 performs the following process. (S501) When there is a hit row (a row that satisfies the condition described in the query) in the inner table scan on the join column A of the current stage, the filter creation unit 130 identifies the range (minimum and maximum values) of the next-stage join column B for the segment 172 containing the hit row from the column range index 173B corresponding to the next-stage join column B. According to the example shown in FIG. 5, the "segment 172 containing the hit row" is segment 5, and the "range of the next-stage join column B" has a minimum value of "411" and a maximum value of "510." When there is a hit row in each of two or more segments 172, the range of the next-stage join column B is identified for the segment 172, and the next step S502 is performed. (S502) Next, filter creation unit 130 uses the range (minimum and maximum values) identified in S501 to search for column range index 173A corresponding to joined column A of the current stage. Filter creation unit 130 identifies segments 172 having values ​​included in the range for joined column A of the current stage. In the example shown in FIG. 5, the identified segments 172 are segment 5 and segment 6. This is because the column A range of segment 5 at least partially overlaps with the column B range of segment 5 (column B range identified in S501), and similarly, the column A range of segment 6 also at least partially overlaps with the column B range of segment 5. (S503) The filter creation unit 130 creates a filter 400 in which the segment IDs of all segments 172 identified in S502 are described. This filter 400 is used for the next-stage inner table scan.

[0042] In creating a filter, it is preferable that the unit of the inner table scan range is not fixed to the segment 172 .

[0043] 6A, when the number of segments 172 identified in S502 for the joined column A of the current stage is small, the filter creation unit 130 writes the segment IDs of the segments 172 identified in S502 in the filter 400 (that is, the unit of the inner table scan range is the segment 172). Note that "the number of identified segments 172 is small" may mean that at least (a2) of the following (a1) and (a2) is satisfied. (a1) For the joined string A in the current stage, the total number of segments 172 identified in S502 is less than the threshold value X. (a2) For the joined sequence A of the current stage, for each of one or more chunks 171 including one or more segments 172 identified in S502, the number of segments 172 identified in S502 is less than a threshold Y1. The threshold Y1 may be determined based on the number of segments 172 that the chunk 171 has. The threshold Y1 may be common to all chunks 171, or may differ depending on the chunk 171.

[0044] Also, for example, as shown in FIG. 6B, when the number of segments 172 identified in S502 for the join column A of the current stage is medium, the filter creation unit 130 writes the chunk IDs of the chunks 171 including each segment 172 identified in S502 in the filter 400 (that is, the unit of the inner table scan range is the chunk 171). In this case, in the next stage of join, the unit for determining the inner table scan range is the chunk 171, which is larger than the segment 172, and therefore the processing performance of the join can be improved. Note that "the number of identified segments 172 is medium" may mean that at least (b2) of the following (b1) and (b2) is satisfied. (b1) For the joined sequence A in the current stage, the total number of segments 172 identified in S502 is less than the threshold value X. (b2) For the joined string A of the current stage, for each of one or more chunks 171 including one or more segments 172 identified in S502, the number of segments 172 identified in S502 is equal to or greater than threshold Y1 and equal to or less than threshold Y2. Similar to threshold Y1, threshold Y2 may be determined based on the number of segments 172 that the chunk 171 has, and may be common to all chunks 171 or may differ depending on the chunk 171. For example, threshold Y2 may be the same value as the total number of segments 172 that constitute the chunk 171.

[0045] Also, for example, as shown in FIG. 6C, when the number of segments 172 identified in S502 for the joined column A of the current stage is large, the filter creation unit 130 may not specify an inner table scan range for the filter 400 (for example, the filter 400 may not be created). In such a case, the determination of the inner table scan range may become a processing overhead, but in this embodiment, such overhead can be avoided. Note that "the number of identified segments 172 is large" may mean that the total number of segments 172 identified in S502 for the joined column A of the current stage is equal to or greater than a threshold value X1, the number of chunks 171 that must be checked on a chunk-by-chunk basis (for example, chunks 171 in which the number of segments 172 identified in S502 is equal to or greater than a certain ratio to the total number of segments of the chunks 171) is equal to or greater than a threshold value X2, or the ratio of the number of chunks 171 that must be checked to the total number of chunks is equal to or greater than a threshold value X3. At least one of the thresholds X1 to X3 may be determined based on the total number of segments 172 that the table has (or the total number of chunks 171 that the table has).

[0046] As described above, in this embodiment, the unit of the inner table scan range is not fixed to the segment 172. A chunk ID may be described in place of or in addition to a segment ID in the filter 400. In other words, the filter 400 may contain a mixture of segment IDs and chunk IDs.

[0047] FIG. 7 shows the flow of query processing according to the first embodiment.

[0048] In the query processing, which is processing performed in response to a recursive query, a recursive join processing is performed. In the recursive join processing, the query execution unit 113 determines whether or not there is an outer table (S701). If there is no outer table, the query execution unit 113 ends the recursive join processing. If there is an outer table, the query execution unit 113 performs the following processing to perform a join between the outer table and the inner table.

[0049] The query execution unit 113 determines whether or not S703 has been performed for each segment 172 of the inner table (S702).

[0050] When S703 has been performed for all segments 172 of the inner table, the query execution unit 113 sets the join result of the current stage to the outer table of the next stage (S711). After that, the process returns to S701. Note that, if there is no join result of the current stage, S711 is skipped and the process returns to S701.

[0051] If there is a segment 172 in the inner table for which S703 has not yet been performed, the query execution unit 113 determines whether or not the segment 172 in the inner table is represented in the filter 400 (S703). "The segment 172 in the inner table is represented in the filter 400" means that the filter 400 exists and the segment ID of the segment 172 or the chunk ID of the chunk containing the segment 172 is described in the filter 400. In other words, the unit of the determination in S703 (determination of the inner table scan range) is the segment 172 or the chunk 171. If the determination result in S703 is false (S703: No), the process returns to S702.

[0052] If the determination result of S703 is true (S703: Yes), the query execution unit 113 determines (S704) whether values ​​(data) have been read from all rows of the segment 172. If values ​​have been read from all rows of the segment 172, the process returns to S702.

[0053] If there are rows in segment 172 whose values ​​have not yet been read, query execution unit 113 reads a value from one of such rows (e.g., the first row) and determines whether the filter creation flag is "ON" (S705). If the determination result of S705 is false (S705: No), S706 to S709 are skipped and S710 is performed.

[0054] If the determination result of S705 is true (S705: Yes), the query execution unit 113 determines whether or not the first line of the segment 172 is a hit line (S706). If the determination result of S706 is false (S706: No), S707 to S709 are skipped and S710 is performed.

[0055] If the determination result in S706 is true (S706: Yes), the filter creation unit 130 identifies the range (minimum and maximum values) of the segment 172 from the column range index 173 of the join column of the next stage (S707). The filter creation unit 130 identifies a segment 172 having a range that at least partially overlaps with the range identified in S707 from the column range index 173 of the join column of the current stage (S708). The filter creation unit 130 performs a next-stage filter creation process (S709). The query execution unit 113 performs a join process with the outer table using the value read from the read source row (S710). After that, the process returns to S704.

[0056] FIG. 8 shows the flow of the next-stage filter creation process (S709 in FIG. 7).

[0057] The filter creation unit 130 determines whether the number of segments 172 identified in S708 is small (S801). If the determination result in S801 is true (S801: Yes), the filter creation unit 130 adds the segment ID of the segment 172 identified in S708 to the filter 400 (S802).

[0058] If the determination result in S801 is false (S801: No), the filter creation unit 130 determines whether the number of segments 172 identified in S707 is medium (S803). If the determination result in S803 is true (S803: Yes), the filter creation unit 130 adds the chunk ID of the chunk 171 including the segment 172 identified in S708 to the filter 400 (S804).

[0059] If the determination result in S803 is false (S803: No), the filter creating unit 130 deletes the created filter 400 for the next stage (S805), and sets the filter creation flag to "OFF" (S806).

[0060] 9 shows the flow of the creation determination process according to the first embodiment. The creation determination process needs to be performed before the start of each stage (however, S901 only needs to be performed once before the start of the query process (processing including the process shown in FIG. 7) in response to the recursive query).

[0061] The creation determination unit 120 determines whether the received query is a recursive query (S901).

[0062] If the determination result in S901 is true (S901: Yes), the creation determination unit 120 determines whether the range overlap is small based on the column range index 173 of each column (S902). The "segment range overlap" may be a value related to the statistics of the range overlap between segments for each column, and the "segment 172 range overlap is small" may be a value related to the statistics that is equal to or smaller than a threshold. The statistical information may be input from outside the database management device 100, or the DBMS 110 may obtain the statistical information at some point before the start of query processing.

[0063] If the determination result of S902 is true (S902: Yes), the creation determination unit 120 sets the filter creation flag to "ON" (S903).

[0064] The above is a description of the first embodiment. [Second embodiment]

[0065] The second embodiment will be described below, focusing mainly on the differences from the first embodiment, and explanations of the points in common with the first embodiment will be omitted or simplified.

[0066] In the second embodiment, the join process is a multi-stage join process following a multi-stage join query.

[0067] FIG. 10 shows an example of a multi-stage joining process.

[0068] In a multi-stage join process (hash join), when a next stage join is performed after creating a hash table, the filter creation unit 130 creates a filter 400 for scanning the inner table of the next stage join when the previous stage join process is performed. In the next stage join, the hash table resulting from the previous stage join is the outer table. In the join between the outer table and the inner table (next stage join), the query execution unit 113 scans only the range of the inner table represented by the filter 400.

[0069] FIG. 11 shows an example of filter creation in multi-stage combining processing.

[0070] 11, the join condition is S1.column A = S2.column B (S1 and S2 are the inner tables). There is a column range index 173X for the join column in the current stage (S1A) and a column range index 173Y for the join column in the next stage (S2B).

[0071] In the example shown in FIG. 11, the filter creation section 130 performs the following process. (S1101) When there is a hit row in the inner table scan on the join column S1A of the current stage, the filter creation unit 130 identifies the range (minimum and maximum values) of the join column of the current stage for the segment 172 containing the hit row from the column range index 173X of the join column S1A of the current stage. According to the example shown in FIG. 11, the "segment 172 containing the hit row" is segment 5, and the "range of the join column S1A of the current stage" has a minimum value of "401" and a maximum value of "500." When there is a hit row in each of two or more segments 172, the range of the join column of the current stage is identified for the segment 172, and the next step S1102 is performed. (S1102) Next, the filter creation unit 130 uses the range (minimum and maximum values) identified in S1101 to search for a column range index 173Y corresponding to the next-stage joined column S2B. The filter creation unit 130 identifies a segment 172 having a value included in the range for the next-stage joined column S2B. According to the example shown in FIG. 11, the identified segments 172 are segment 4 and segment 5. This is because the column S1B range of segment 4 at least partially overlaps with the column S1A range of segment 5 (the range identified in S501), and similarly, the column S1B range of segment 5 also at least partially overlaps with the column S1A range of segment 5. (S1103) The filter creation unit 130 creates a filter 400 in which the segment IDs of all the segments 172 identified in S1102 are described. This filter 400 is used for the next stage of inner table scan. Note that, depending on the number of segments 172 identified in S1102, chunk IDs may be described instead of segment IDs.

[0072] FIG. 12 shows the flow of query processing according to the second embodiment.

[0073] In the query processing, which is processing performed in response to a multi-stage join query, a multi-stage join process is performed. In the multi-stage join process, the query execution unit 113 determines whether or not the join of all stages according to the multi-stage join query has been completed (S1201). When the join of all stages has been completed, the query execution unit 113 ends the multi-stage join process. If there are still stages remaining, the query execution unit 113 performs the following process.

[0074] The query execution unit 113 judges whether or not S1203 has been performed for each segment 172 of the inner table (S1202).

[0075] When S1203 has been performed for all segments 172 of the inner table, the query execution unit 113 sets the join result of the current stage to the outer table of the next stage (S1211). After that, the process returns to S1201.

[0076] If there is a segment 172 in the inner table for which S1203 has not yet been performed, the query execution unit 113 determines whether or not the segment 172 in the inner table is represented in the filter 400 (S1203). If the determination result in S1203 is false (S1203: No), the process returns to S1202.

[0077] If the determination result of S1203 is true (S1203: Yes), the query execution unit 113 determines (S1204) whether values ​​(data) have been read from all rows of the segment 172. If values ​​have been read from all rows of the segment 172, the process returns to S1202.

[0078] If there are rows in the segment 172 whose values ​​have not yet been read, the query execution unit 113 reads a value from one of such rows (e.g., the first row) and performs a join process with the outer table using the value (S1205). The query execution unit 113 determines whether the filter creation flag is "ON" (S1206). If the determination result of S1206 is false (S1206: No), S1207 to S1210 are skipped and the process returns to S1204.

[0079] If the determination result of S1206 is true (S1206: Yes), the query execution unit 113 determines whether or not the first line of the segment 172 is a hit line (S1207). If the determination result of S1207 is false (S1207: No), S1208 to S1210 are skipped and the process returns to S1204.

[0080] If the determination result in S1207 is true (S1207: Yes), the filter creation unit 130 identifies the range (minimum and maximum values) of the segment 172 from the column range index 173 of the joined column of the current stage (S1208). The filter creation unit 130 identifies a segment 172 having a range that at least partially overlaps with the range identified in S1208 from the column range index 173 of the joined column of the next stage (S1209). The filter creation unit 130 performs the next stage filter creation process (FIG. 8) (S1210).

[0081] The above is a description of the second embodiment. Note that in the creation determination process according to the second embodiment, the determination in S901 in Fig. 9 is a determination as to whether the received query is a multi-stage join query or not, instead of a determination as to whether the received query is a recursive query or not. If the result of the determination is true, S902 and S903 are performed. Also, the determination as to whether the query is a multi-stage join query or not may be performed once before the start of query processing (processing including the processing shown in Fig. 12) in response to the multi-stage join query, but S902 needs to be performed before the start of each stage.

[0082] The above description can be summarized, for example, as follows. The following summary may include supplementary explanations and explanations of modifications.

[0083] The database management device 100 includes a query receiving unit 111 that receives a query for a database 141 stored in an external storage device 140 (an example of a storage device), a query execution unit 113 that executes a query process that is a process in response to the query, and a filter creation unit 130 that creates a filter that is data that represents a scan range of an inner table. The external storage device 140 stores a column range index that is data that represents a range of values ​​stored in a table. The query process is a process in which a join process including a multi-stage join is performed. In each stage of the join process, when the join result of the current stage becomes an outer table related to the join of the next stage, the filter creation unit 130 performs a filter creation process. The query execution unit 113 scans only the range represented by the filter 400 created in the filter creation process, among the inner tables related to the join of the next stage. The filter creation process includes identifying whether or not the inner table related to the join of the next stage may include a hit row in the inner table related to the join of the current stage, based on a column range index corresponding to the join column of the current stage and a column range index corresponding to the join column of the next stage. This makes it possible to limit the scan range of the inner table in the join process regardless of the presence or absence of a search condition or a partition key, and also improves the performance of the join process.

[0084] Table 151 in database 141 may be composed of multiple segments 172. Each of the multiple segments 172 may be a unit larger than a row, may be composed of two or more rows of table 151, and may have multiple columns that table 151 has. In external storage device 140, a column range index may exist for each segment 172. Each column range index may represent a range of values ​​stored in the segment 172 corresponding to the column range index.

[0085] The filter creation process may include identifying a segment 172 having a range that overlaps at least a portion of the range of a segment 172 containing a hit row in the inner table involved in the join of the current stage based on a column range index 173 (e.g., 173A or 173X) corresponding to the join column of the current stage and a column range index 173 (e.g., 173B or 173Y) corresponding to the join column of the next stage, and adding data representing the identified segment 172 to the filter 400.

[0086] In this way, the filter 400 describes the inner table scan range of the next stage, but the inner table scan range may be the segment 172 larger than the row. Therefore, in the next stage join, the unit for determining the inner table scan range is the segment 172 larger than the row, and therefore the processing performance of the join can be improved. In addition, since the segment 172 as the inner table scan range of the next stage can be specified based on the column range index 173 of the join column of the current stage and the join column of the next stage, it is possible to limit the scan range of the inner table in the join process regardless of the presence or absence of a search condition or a partition key. Note that the filter creation process may further include determining to perform a scan of the inner table related to the join of the next stage if there is a possibility that the inner table related to the join of the next stage contains a hit row in the inner table related to the join of the current stage. When it is determined to perform a scan of the inner table related to the join of the next stage, the query execution unit 113 may scan only the range represented by the filter 400 created in the filter creation process.

[0087] The filter creation unit 130 may perform a filter creation process when there is the first hit row of the segment 172. This can avoid wasteful operations such as performing segment identification and filter creation processes (e.g., S707 to S709 or S1208 to S1210) for the same segment 172 every time a hit row is found for the same segment 172, and can contribute to improving the performance of the joining process.

[0088] The database management device 100 may further include a creation determination unit 120. When the query processing includes a join processing including a multi-stage join, the creation determination unit 120 may perform a creation determination to determine (A) whether or not the overlap of ranges between segments for each column is small, or (B) whether or not the application using the value stored in the database is a predetermined application. The filter creation unit 130 may perform a filter creation process when the result of the creation determination is true (for example, when the filter creation flag is "ON"). This makes it possible to avoid creating the filter 400 when the effect of limiting the scan range of the inner table is small due to a large amount of range overlap between segments in the column.

[0089] An example of the creation determination (A) may be as follows. That is, the creation determination unit 120 may check the range distribution for each segment for each column based on the column range index 173 of each column, and determine whether the range overlap is small. If it is determined that the range overlap is small for all columns that can be joined columns in the join process, the result of the creation determination may be true (for example, the filter creation flag is "ON").

[0090] An example of the creation decision (B) may be as follows. That is, the "predetermined application" may be any type of application that results in a database in which range overlap is expected to be small in each column. For example, as shown in FIG. 13, an industrial application is one such application. A database related to an industrial application (e.g., parts production) often becomes graph-structured data. For example, parts are close in time, and in the database, data at the recursion destination is also close in time. In an industrial application, a process (traverse) of tracing the graph-structured data is one of the main search patterns. A recursive query may be used to traverse the graph-structured data. In a recursive query, a join process between data (original data) extracted from a history table (inner table) and data in another part of the history table may be repeatedly performed. In such a join process, only the part related to the original data is scanned, and the performance of the join process is improved, and thus the traversal time of the graph-structured data is expected to be shortened.

[0091] Table 151 may be made up of multiple chunks 171, and each chunk 171 may be made up of two or more segments 172. Filter creation unit 130 selects whether the scan unit will be the segment 172, the chunk 171, or the entire inner table, depending on the number of identified segments 172, and may update filter 400 or not create filter 400 depending on the selected scan unit. This is expected to further improve the performance of the join process.

[0092] Specifically, for example, if the number of identified segments satisfies the condition that the number of segments is small, the scan unit may be a segment. If the number of identified segments satisfies the condition that the number of segments is medium, the scan unit may be a chunk. If the number of identified segments satisfies the condition that the number of segments is large, the scan unit may be the entire inner table. This makes it possible to set the scan unit to an appropriate size, such as a segment or chunk, depending on the number of segments, and to avoid the overhead of creating filter 400 depending on the number of segments.

[0093] The join process may be a recursive join process. The filter creation process may include identifying a range of a segment 172 including a hit row in the inner table related to the join of the current stage from a column range index 173B corresponding to the join column of the next stage (e.g., S501 or S707), identifying a segment 172 having a range that overlaps at least a part of the identified range from a column range index 173A corresponding to the join column of the current stage (e.g., S502 or S708), and adding data (e.g., a segment ID or a chunk ID) representing the identified segment 172 to the filter (e.g., S503 or S709). This can improve the performance of the recursive join process.

[0094] The join process may be a multi-stage join process. The filter creation process may include identifying a range of a segment 172 including a hit row in the inner table related to the join of the current stage from a column range index 173X corresponding to the join column of the current stage (e.g., S1101 or S1208), identifying a segment 172 having a range that overlaps at least a part of the identified range from a column range index 173Y corresponding to the join column of the next stage (e.g., S1102 or S1209), and adding data representing the identified segment 172 to a filter (e.g., S1103 or S1210). This can improve the performance of the multi-stage join process.

[0095] Although several embodiments have been described above, these are merely examples for explaining the present invention, and the scope of the present invention is not limited to these embodiments. The present invention can be implemented in various other forms. [Explanation of symbols]

[0096] 100...Database management device

Claims

1. a query receiving unit that receives a query to a database stored in the storage device; a query execution unit that executes a query process in response to the query; a filter creation unit that creates a filter, which is data that represents the scan range of the inner table; Equipped with the storage device stores a column range index which is data representing a range of values ​​stored in a table; the query processing is a processing in which a join processing including a multi-stage join is performed, In each stage of the join process, if the join result of the current stage becomes the outer table related to the join of the next stage, The filter creation unit performs a filter creation process, the query execution unit scans only a range represented by the filter created in the filter creation process, of the inner table related to the next-stage join; the filter creation process includes determining whether or not an inner table involved in a next-stage join is likely to include a hit row in the inner table involved in the join of the current stage based on a column range index corresponding to a join column of the current stage and a column range index corresponding to a join column of the next stage; Database management device.

2. The filter creation process further includes determining to perform a scan of the inner table involved in the next join step when there is a possibility that the inner table involved in the next join step contains a hit row in the inner table involved in the current join step.

2. The database management device according to claim 1.

3. A table in the database is composed of a plurality of segments, Each of the plurality of segments is a unit larger than a row, is composed of two or more rows of the table, and has a plurality of columns that the table has; the column range index exists for each segment, Each column range index is data that represents a range of values ​​stored in a column of the segment that corresponds to the column range index, The filter creation process includes: Identifying a segment having a range that overlaps at least a part of a range of a segment including a hit row in the inner table involved in the join of the current stage based on a column range index corresponding to the join column of the current stage and a column range index corresponding to the join column of the next stage; Adding data representing the identified segments to the filter Including, 2. The database management device according to claim 1.

4. the filter creation unit performs the filter creation process when a first hit row is found in a segment.

4. The database management device according to claim 3.

5. a creation determination unit that performs a creation determination in which, when the query processing includes the join processing including the multiple-stage join, the query processing determines whether or not the overlap between ranges of segments for each column is small, or whether or not an application in which a value stored in the database is used is a predetermined application; Further comprising: the filter creation unit performs the filter creation process when the result of the creation determination is true.

4. The database management device according to claim 3.

6. A table in the database is composed of a plurality of chunks, Each chunk consists of two or more segments, the filter creation unit selects whether a scan unit is to be a segment, a chunk, or an entire inner table, depending on the number of the identified segments, and updates the filter or does not create the filter depending on the selected scan unit; 4. The database management device according to claim 3.

7. If the number of the identified segments satisfies the condition that the number of segments is small, the scanning unit is a segment; If the number of the identified segments satisfies the condition that the number of segments is medium, the scanning unit is a chunk; If the number of the identified segments satisfies the condition that the number of segments is large, the scan unit is the entire inner table.

7. The database management device according to claim 6.

8. the joining process is a recursive joining process, The filter creation process includes: Identifying a range of a segment including a hit row in the inner table involved in the join of the current stage from a column range index corresponding to the join column of the next stage; identifying a segment having a range that overlaps at least a portion of the identified range from a column range index corresponding to the join column of the current stage; adding data representing the identified segment to a filter; Including, 4. The database management device according to claim 3.

9. The bonding process is a multi-stage bonding process, The filter creation process includes: Identifying a range of a segment including a hit row in the inner table involved in the join of the current stage from a column range index corresponding to the join column of the current stage; identifying a segment having a range that overlaps at least a portion of the identified range from a column range index corresponding to the join column in the next stage; adding data representing the identified segment to a filter; Including, 4. The database management device according to claim 3.

10. a creation determination unit that performs a creation determination, which is a determination as to whether an application in which a value stored in the database is used is a predetermined application, when the query processing includes the join processing including the multiple-stage join; Further comprising: the filter creation unit performs the filter creation process when the result of the creation determination is true.

2. The database management device according to claim 1.

11. When a query process, which is a process in response to a query of a database stored in a storage device, is a process in which a join process including a multi-stage join is performed, and in each stage of the join process, the join result of the current stage becomes an outer table related to the join of the next stage, The computer performs the filter creation process, The computer scans only the range represented by the filter created in the filter creation process, among the inner tables related to the next-stage join; the storage device stores a column range index which is data representing a range of values ​​stored in a table; The filter is data representing a scan range of an inner table, the filter creation process includes determining whether or not an inner table involved in a next-stage join is likely to include a hit row in the inner table involved in the join of the current stage based on a column range index corresponding to a join column of the current stage and a column range index corresponding to a join column of the next stage; Database management methods.

12. When a query process, which is a process in response to a query of a database stored in a storage device, is a process in which a join process including a multi-stage join is performed, and in each stage of the join process, the join result of the current stage becomes an outer table related to the join of the next stage, The filter creation process is performed. Among the inner tables related to the next join, only the range represented by the filter created in the filter creation process is scanned. Have the computer do this, the storage device stores a column range index which is data representing a range of values ​​stored in a table; The filter is data representing a scan range of an inner table, the filter creation process includes determining whether or not an inner table involved in a next-stage join is likely to include a hit row in the inner table involved in the join of the current stage based on a column range index corresponding to a join column of the current stage and a column range index corresponding to a join column of the next stage; Computer program.

Citation Information

Patent Citations

  • Subquery predicate generation to reduce processing in a multi-table join

    US20180285415A1

  • Database management system and database management method

    WO2015025401A1

  • US10,810,20