Scheduling query execution plans on a database
By determining the public nature of data block partitions based on metadata in a relational database system, disabling locking mechanisms and allowing parallel query execution, the increased computational cost and data access isolation issues caused by locking mechanisms are resolved, resulting in more efficient query execution plan scheduling.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INTERNATIONAL BUSINESS MACHINE CORPORATION
- Filing Date
- 2021-12-07
- Publication Date
- 2026-04-28
AI Technical Summary
In existing technologies, relational database systems suffer from increased computational costs and data access isolation issues when executing multiple queries in parallel due to locking mechanisms. This is especially true when there is no common partition, where the activation of locking mechanisms increases the additional computational load.
By determining whether there are common partitions in the partitions of data blocks in the relational database system based on metadata, and disabling the locking mechanism when there are no common partitions, the query execution plan can be executed in parallel, reducing the computational load of the locking mechanism, and optimizing the scheduling of the query execution plan by sharing results through caching.
It effectively reduces the computational cost of parallel query execution in relational database systems, improves the isolation and efficiency of data access, reduces the activation frequency of locking mechanisms, and optimizes the scheduling of query execution plans.
Smart Images

Figure CN116569163B_ABST
Abstract
Description
Background Technology
[0001] This disclosure relates to the field of database technology, and more specifically, to a method for scheduling queries for accessing datasets in a relational database system.
[0002] Relational database systems consist of interconnected tables. Queries are used to retrieve and update datasets based on criteria defined in the form of expressions and predicates. The query optimizer of a relational database system can optimize queries against predicates. For example, the computational cost of executing different variations of the query on the database system can be estimated based on the predicates, and the query can be optimized with regard to reducing the computational cost. The optimized query can then be translated into a query execution plan. The query execution plan can be scheduled using the relational database system's workload manager. Summary of the Invention
[0003] Various embodiments provide computer systems and methods as described in the independent claims. Advantageous embodiments are described in the dependent claims. The embodiments of this disclosure may be freely combined with each other if they are not mutually exclusive.
[0004] In one aspect, this disclosure relates to a method for scheduling a set of query execution plans, the set of query execution plans including at least a first query execution plan for executing a first query and a second query execution plan for executing a second query, the first query being for accessing a first dataset of data from a relational database system RDBS, and the second query being for accessing a second dataset of the data, the data being divided into data blocks of the dataset, wherein the metadata of the RDBS includes corresponding information about at least one characteristic of the dataset of the corresponding data block. The method includes...
[0005] When the first query execution plan is executed on RDBS based on metadata and the conditions that the first dataset must satisfy for the first query, the first partition of the data block is determined to be potentially accessed;
[0006] When the second query execution plan is executed on RDBS based on metadata and the conditions that the second dataset must meet according to the second query, it is determined that the second partition of the data block is potentially being accessed;
[0007] If a common partition exists between the data blocks of the first and second partitions, then perform the check;
[0008] The first and second query execution plans on RDBS are scheduled based on the results of the inspection.
[0009] In another aspect, this disclosure relates to a computer program product comprising a computer-readable storage medium having computer-readable program code configured to implement the method according to the foregoing embodiments.
[0010] On the other hand, this disclosure relates to a computer system for scheduling a set of query execution plans, the set of query execution plans including at least a first query execution plan for executing a first query and a second query execution plan for executing a second query, the first query being for accessing a first dataset of a relational database system (RDBS), and the second query being for accessing a second dataset of data, the data being divided into data blocks of the dataset, wherein the metadata of the RDBS includes corresponding information about at least one characteristic of the dataset of the corresponding data block. The computer system can be configured for...
[0011] When the first query execution plan is executed on RDBS based on metadata and the conditions that the first dataset must satisfy for the first query, the first partition of the data block is determined to be potentially accessed;
[0012] When the second query execution plan is executed on RDBS based on metadata and the conditions that the second dataset must meet according to the second query, it is determined that the second partition of the data block is potentially being accessed;
[0013] If a common partition exists between the data blocks of the first partition and the second partition, then perform a check;
[0014] The first and second query execution plans on RDBS are scheduled based on the results of the inspection. Attached Figure Description
[0015] The following embodiments of this disclosure are explained in more detail by way of example only, with reference to the accompanying drawings, wherein:
[0016] Figure 1 A computer system based on this topic is shown;
[0017] Figure 2 Describes the connection to Figure 1 The network of computer systems;
[0018] Figure 3 It describes a relational database system;
[0019] Figure 4 Described Figure 3 The data tables of the relational database system show the composition of the first partition of the data block and the composition of the second partition of the data block according to the first use case;
[0020] Figure 5 Describes instructions Figure 4The table contains the metadata of the data blocks in the data table;
[0021] Figure 6 A scheduling table is described for scheduling the first and second query execution plans on RDBS;
[0022] Figure 7 The composition of the first partition of the data block and the composition of the second partition of the data block are shown according to the second use case.
[0023] Figure 8 Another scheduling table is described for scheduling the first and second query execution plans on RDBS;
[0024] Figure 9 A scheduling table for scheduling the first and second query execution plans on RDBS is shown according to another variant;
[0025] Figure 10 Describes instructions Figure 7 The table contains additional metadata for the data blocks of the data table;
[0026] Figure 11 The composition of the first partition of a data block and the composition of the second partition of a data block are shown according to another variant of the first use case;
[0027] Figure 12 The composition of the first partition of a data block and the composition of the second partition of a data block are shown according to another variant of the second use case;
[0028] Figure 13 A flowchart is described for a computer-implemented method for scheduling a first query execution plan and a second query execution plan on RDBS. Detailed Implementation
[0029] This disclosure relates to the field of database technology, and more specifically, to a method for scheduling queries for accessing datasets in a relational database system. Descriptions of various embodiments of this disclosure are presented for illustrative purposes and are not intended to be exhaustive or limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles of the embodiments, their practical application, or improvements to existing technologies in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.
[0030] The term Relational Database System (RDBS) used in this document is also referred to as Relational Database Management System (RDBMS). Additionally, in the following text, the terms First Query Execution Plan and Second Query Execution Plan may also be referred to as First Plan and Second Plan, respectively. Furthermore, the common partition of the data blocks in the First Partition and Second Partition may also be referred to as the common partition. Checking whether the common partition exists may also be referred to as a check.
[0031] The condition that the first dataset must satisfy according to the first query is also referred to hereinafter as the first condition. Similarly, the condition that the second dataset must satisfy according to the second query is also referred to hereinafter as the second condition. The first plan includes commands for accessing (i.e., reading) the first dataset and / or for modifying the first dataset. Similarly, the second plan includes commands for accessing (i.e., reading) the second dataset and / or for modifying the second dataset. The first plan and the second plan can be generated based on the first query and the second query, respectively, using RDBS' query compiler. The first and second queries each include a first statement containing the first condition and a second statement containing the second condition, respectively.
[0032] Scheduling the first and second plans based on the results of the checks has the following advantages. First, without a common partition, a single dataset of data can only be accessed by executing the first plan or by executing the second plan on RDBS. In other words, a dataset cannot be accessed first by running the first plan and then second by running the second plan, and vice versa. Therefore, declaring the absence of a common partition is equivalent to declaring the absence of any dataset that can be accessed both when executing the first plan and when executing the second plan. This means that without a common partition, the execution of the first and second plans is isolated from each other with respect to the datasets of data.
[0033] For example, the first plan may not cause an update to a dataset within the data set, which can be read by executing the second plan, and vice versa. Therefore, performing a check if a common partition exists guarantees the isolation of the first plan relative to the second plan; if no common partition exists, the data set is considered. This can reduce the computational cost of RDBS when executing the first and second plans in parallel.
[0034] For example, without a common partition, the locking mechanism of RDBS can cause the first and second plans to execute differently on RDBS. This locking mechanism is used to lock at least a portion of the first partition and / or the second partition of a data block, so that these data blocks can only be accessed at any given time by executing a single query execution plan. Without a common partition, the locking mechanism may, for example, not lock the first and / or second partitions of the data block when the first and second plans are executed in parallel.
[0035] However, if a common partition exists, the locking mechanism can lock the first and / or second partitions of a data block when the first and second plans are executed in parallel. Therefore, if no common partition exists, the computational load required to lock the first and / or second partitions of the data block can be reduced. This is advantageous if the first and second plans access the same data table in the RDBS.
[0036] Typically, if the first and second plans access the same data table, the locking mechanism is activated. However, embodiments of this disclosure overcome this drawback by disabling the locking mechanism if there is no common partition when the first and second plans access the same data table. Access isolation is guaranteed when there is no access to the common partition.
[0037] In some embodiments, the determination of data blocks accessed by the first and second partitions is based on metadata. Additionally, scheduling can be performed based on the results of the checks. Information about the data from the checks can also be used for scheduling. This information can be used to reduce restrictions on the execution of the first and / or second schedules. Reducing restrictions can lead to the unlocking of the first and / or second partitions. Reducing restrictions typically reduces computational resources and time.
[0038] Furthermore, when there are no common partitions between the plans, it is unnecessary to schedule the first and second plans so that their execution times do not overlap. This is typically done to prevent locking mechanisms from being activated, for example, if the first and second plans access the same data table. Therefore, without common partitions, scheduling constraints can be reduced or discarded. In this case, optimizing the scheduling of the set of query execution plans can be simplified to several constraints, which can be considered as boundary conditions for optimizing plan scheduling.
[0039] Furthermore, if a common partition exists, the results of the first plan can be used for the second plan, and vice versa. This reduces the number of datasets accessed when executing the first and second plans, potentially lowering computational costs.
[0040] In some embodiments, it is determined whether a first partition includes a first complementary partition containing discarded data blocks based on metadata with a first condition, the first condition being such that the first dataset must be satisfied according to a first query. The first complementary partition of a data block may represent a data block that is not being accessed when the first query execution plan is executed on RDBS. Furthermore, in some embodiments, it is determined whether a second partition includes a second complementary partition containing discarded data blocks using metadata and a second condition that the second dataset must be satisfied according to a second query. The second complementary partition of a data block may represent a data block that is not being accessed when the second query execution plan is executed on RDBS. The first complementary partition is considered complementary to the first partition, and vice versa. This means that the first partition and the first complementary partition are disjoint and can be used to construct data together. Similarly, the second complementary partition is considered complementary to the second partition, and vice versa. This means that the second partition and the second complementary partition are disjoint and also used to construct data together.
[0041] Determining whether to discard the first complementary partition is advantageous because it avoids having to find all data blocks not accessed during the execution of the first plan in order to create the first complementary partition. Conversely, if the first complementary partition is not determined by discarding it, then all possible data blocks potentially accessed during the execution of the first plan must be found in order to safely declare that no common partition exists if the results of the check suggest otherwise. To do this, the metadata of all corresponding data blocks must be checked against the first condition. Completing this procedure can take much longer, especially if the data blocks are very small and numerous.
[0042] However, the generation of the first complementary partition can be aborted at any time and does not necessarily have to be completed. In this case, if the first partition is determined to be complementary to the first complementary partition, then the result of the check can be considered deterministic if the result is that there is no common partition. Therefore, this embodiment can speed up the generation of the first partition. Similarly, determining the second partition by discarding the second complementary partition can lead to the same advantages for the same reasoning applied to the second partition, the second condition, and the second complementary partition. Metadata can be considered as much more compact information about the data than, for example, an index of each dataset of the indexed data. Such compact information may not be very suitable for checking if one dataset in the dataset of the data can satisfy the first or second condition. However, such compact information in the form of metadata can be very useful for discarding data blocks of the dataset that may not be accessed in order to test the first or second condition on these datasets. This effect can be used for scheduling.
[0043] In some embodiments, the method further includes scheduling a first query execution plan and a second query execution plan such that, if a common partition exists for the data blocks of the first and second partitions, the results of the first query execution plan are available in the RDBS cache for use by the second query execution plan. For example, the first and second plans can be scheduled such that when the second plan is executed on the RDBS, at least a portion of the results of the first plan is stored in the cache, or vice versa if a common partition exists. This embodiment ensures that at least a portion of the results of the first plan can be used to execute the second plan, or vice versa if a common partition exists. Scheduling can be performed based on the actual space available on the cache and an estimated required size of the cache storing the results or portions of the results of the first or second plan.
[0044] In some embodiments, the method further includes activating a locking mechanism of the RDBS to lock data blocks of a common partition, such that these data blocks can only be accessed by executing a single query execution plan at a time. The locking mechanism can be activated if a common partition exists. The single execution plan can be a first plan or a second plan. This variation ensures data isolation and is preserved while the first and second plans are running. As used herein, the term "data isolation" implies that parallel execution of the set of query execution plans results in the data being in the same state that would be obtained if these plans were executed sequentially.
[0045] In some embodiments, the method further includes scheduling a first query execution plan and a second query execution plan such that if the data blocks of the first and second partitions do not share a common partition, the first and second query execution plans are executed in parallel on the RDBS. The parallel execution of the first and second plans can accelerate the execution of the query execution plan set. In the absence of a common partition, the first and second plans can execute in parallel, and the computational load required to lock the first and / or second partitions of the data blocks can be very low or even zero. Therefore, the locking mechanism does not degrade the acceleration of the query execution plan set. If the common partition does not exist, i.e., the size of the common partition is zero, the first and second plans run in parallel without the risk of losing data isolation. In most cases, if there is no common partition, the locking mechanism is not activated for the first and / or second partitions.
[0046] In some embodiments, the method includes disabling a locking mechanism of RDBS that locks at least a portion of a first partition and a second partition of a data block. The locking mechanism ensures that these data blocks are accessed only by executing a single query execution plan at any given time. According to an embodiment, the locking mechanism can be disabled if there is no common partition. The locking mechanism can be disabled if the first and second plans are executed in parallel. According to the locking mechanism, even if no common partition exists, the locking mechanism can allocate computational resources during the execution of the first and second plans. For example, the locking mechanism includes functionality for checking for the existence of a common partition. In this case, disabling the locking mechanism can reduce computational costs if no common partition exists.
[0047] In some embodiments, information about the characteristics of a dataset for a given data block is the range of data values within that dataset. This range can be defined by the minimum and maximum data values within the given data block. Using this range as relevant information about the characteristics of the dataset for a given data block—that is, using this range as metadata—has the advantage of providing essential information about these datasets using only two values, the minimum and maximum data values, which can reduce the runtime of the first or second plan. For example, based on this range, if the datasets of one or more given data blocks do not match the first or second condition, these data blocks are discarded. The range of data values within the datasets of each data block can represent one of the most concise pieces of information about these datasets and can also help reduce the runtime of the first and second plans.
[0048] In some embodiments, data tables are used to store the data of the RDBS. This range is defined by the minimum data value in a column of the data table within its corresponding data block and the maximum data value in a column of the data table within its corresponding data block. The corresponding data block may indicate the corresponding block of rows in the data table. If the range involves data values in the columns of the table, determining first and second partitions, particularly discarding first and second complementary partitions, can be performed at a finer level. This can result in the expansion of the first and / or second complementary partitions and a reduction in the size of the first and / or second partitions. Therefore, the computational cost for executing the first and / or second plans can be reduced.
[0049] In some embodiments, the characteristics of a dataset can be the distribution of data values within a corresponding data block. Relevant information about the characteristics of the dataset within a corresponding data block can describe the distribution of data values. The distribution of data values within a corresponding data block can contain more information about the dataset in that block and can make it possible to determine first and second partitions, particularly during the execution of discarding first and second complementary partitions. For the same reasoning described above, this can reduce the computational cost of executing the first and / or second plan. The information describing the distribution includes multiple intervals dividing the aforementioned range into equal-length portions. The information describing the distribution may also include a corresponding number of datasets corresponding to each interval, the number of datasets indicating the number of datasets comprising the data values located within the corresponding interval. Alternatively or additionally, the information describing the distribution includes the distribution type of the data values in the dataset.
[0050] In some embodiments, a data table is used to store the data of the RDBS, the data table having a distribution, which refers to the distribution of data values in the columns of the data table within a corresponding data block. Corresponding information about the characteristics of the dataset of the corresponding data block describes the distribution of data values in the columns of the data table within the corresponding data block. A corresponding data block can indicate a corresponding block of rows in the data table. This can increase the level of refinement when executing the first and / or second plans. Similarly, increased refinement can reduce the computational cost used to execute the first and / or second plans.
[0051] In some embodiments, the distribution is represented by a density vector. This vector can represent a compact form of the corresponding number of datasets for each interval.
[0052] In some embodiments, one of the two query execution plans (i.e., the first or second query execution plan) may run at the actual time, and the other of the two query execution plans may be scheduled to start at a future time. This describes the use of the proposed method in cases where one of the query execution plans (i.e., the first or second plan) is currently running on RDBS, while the other is not currently running but is scheduled to run in the future. Therefore, embodiments of this disclosure are not limited to applications where the first and second plans run in the future, considering the actual time as the time of execution scheduling.
[0053] In some embodiments, the first query execution plan and the second query execution plan are scheduled to run immediately after each other. This can increase the probability that the result of the first plan is available in the RDBS cache for use with the second plan, and vice versa. This embodiment is advantageous if a common partition exists.
[0054] In some embodiments, the method includes receiving metadata from the RDBS query optimizer. The query optimizer can use the metadata for its own purposes, namely, to optimize a first and / or second plan. For this purpose, the query optimizer may have already loaded the metadata of the corresponding data block referencing the data block from the metadata database into the query optimizer's cache. The RDBS workload manager can perform scheduling by reading the metadata from the query optimizer's cache. This can be faster than reading the metadata from the metadata database again.
[0055] In some embodiments, the method includes receiving information from the RDBS query optimizer for specifying a first partition and a second partition. The query optimizer may intersect the first and second statements of the first and second queries with metadata, respectively. In doing so, the query optimizer may retrieve information for specifying the first and second partitions. In other words, this describes an efficient use of information already computed by the query optimizer.
[0056] In some embodiments, the method includes setting boundary conditions for the query optimizer running RDBS such that the common partition is empty. The aforementioned advantages can be achieved if the query optimizer generates first and second plans such that no common partition exists. It is possible that the first and / or second plans may also be less efficient as a single query execution plan. However, if the common partition is empty, the reduction in computational load can overcome this inefficiency.
[0057] Embodiments of this disclosure can be implemented using a computing device, which may also be referred to as a computer system, client, or server. Reference is now made to... Figure 1 The diagram illustrates an example of computer system 10. Computer system 10 may be merely one example of a suitable computer system and is not intended to impose any limitation on the scope or functionality of the embodiments described herein. In any case, computer system 10 is capable of implementing and / or performing any of the functions set forth above.
[0058] Computer system 10 includes computer system / server 12, which can operate with many other general-purpose or special-purpose computing system environments or configurations. Examples of well-known computing systems, environments, and / or configurations that may be suitable for computer system / server 12 include, but are not limited to, Figure 3 The stack 303 of the relational database system 300 shown, the query compiler 302 of the RDBS 300, personal computer systems, server computer systems, thin clients, fat clients, handheld or laptop devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputer systems, mainframe computer systems, and distributed computing environments that include any of the above systems or devices.
[0059] In one example, computer system / server 12 can be designed as a workload manager 301 of RDBS 300, such as Figure 3 As shown, RDBS 300 includes a query compiler 302 for compiling queries such as a first query 311 and a second query 312 into query execution plans, such as a first query execution plan 321, also referred to below as a first plan 321, and a second query execution plan 322, also referred to below as a second plan 322.
[0060] Computer system / server 12 can be described in the general context of computer system executable instructions, such as program modules executed by the computer system. Typically, program modules can include routines, programs, objects, components, logic, data structures, etc., that perform specific tasks or implement specific abstract data types. Computer system / server 12 can be implemented in a distributed computing environment where tasks are performed by remote processing devices linked via a communication network. In a distributed computing environment, program modules can reside in local and remote computer system storage media, including memory storage devices. An example of a remote processing device could be a query compiler 302, which can perform tasks of workload manager 301.
[0061] like Figure 1 As shown, the computer system / server 12 in computer system 10 is illustrated as a general-purpose computing device. Components of the computer system / server 12 may include, but are not limited to, one or more processors or processing units 16, system memory 28, and a bus 18 that couples various system components, including system memory 28, to the processor 16. Bus 18 represents one or more of several types of bus architectures, including memory buses or memory controllers, peripheral buses, accelerated graphics ports, and processor or local buses using any of various bus architectures. By way of example and not limitation, these architectures include the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MCA) bus, the Enhanced ISA (EISA) bus, the Video Electronics Standards Association (VESA) local bus, the Peripheral Component Interconnect (PCI) bus, and the Peripheral Component Interconnect Fast (PCIe) bus.
[0062] Computer system / server 12 typically includes various computer system readable media. Such media can be any available media accessible to computer system / server 12, and it includes volatile and non-volatile media, removable and non-removable media.
[0063] System memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30, solid-state drive (SSD), and / or cache memory 32. Computer system / server 12 may also include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 may be provided for reading from and writing to non-removable, non-volatile magnetic media (not shown, and generally referred to as "hard disk drives"). Although not shown, disk drives for reading from and writing to removable, non-volatile disks (e.g., "floppy disks") and optical disk drives for reading from or writing to removable, non-volatile optical disks such as CD-ROMs, DVD-ROMs, or other optical media may be provided. In this case, each may be connected to bus 18 via one or more data media interfaces. As will be further described below, memory 28 may contain at least one program product having a set (e.g., at least one) of program modules configured to perform embodiments of the invention.
[0064] A program / utility 40 having a set (at least one) of program modules 50, along with an operating system, one or more applications, other program modules, and program data, may be stored in memory 28, as an example and not a limitation. Each or some combination of the operating system, one or more applications, other program modules, and program data may include an implementation of a networking environment. Program modules 50 are generally configured to perform the functions and / or methods of embodiments of the invention as described herein.
[0065] As used herein, the term "program" or "program module" refers to a set of instructions that contain commands that trigger actions to be executed by the processor 16 when the processor 16 can read the commands. This set of instructions may be in the form of a computer-readable program, routine, subroutine, or part of a library that can be executed by the processor 16 and / or by other program calls that can be executed by the processor 16. Preferably, program module 50 may be an executable program compiled according to the type of hardware platform of the computer system / server 12.
[0066] The computer system / server 12 can also communicate with one or more external devices 14, such as a keyboard, indicating devices, a display 24, etc.; one or more devices that enable a user to interact with the computer system / server 12; and / or any device that enables the computer system / server 12 to communicate with one or more other computing devices (e.g., a network interface card, a modem, etc.). This communication can occur via input / output (I / O) interface 22; however, the computer system / server 12 can communicate with one or more networks via network adapter 20, such as a local area network (LAN), a general wide area network (WAN), and / or a public network (e.g., the Internet). As shown, network adapter 20 can communicate with other components of the computer system / server 12 via bus 18. It should be understood that, although not shown, other hardware and / or software components can be used in conjunction with the computer system / server 12, examples including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data archive storage systems.
[0067] Such as Figure 1 The computer system 10 shown can be used to perform the operations disclosed herein, such as the first, second, third, fourth, fifth, and sixth operations. For example, processor 16 can perform the first, second, third, fourth, fifth, and sixth operations.
[0068] Computer system 10 can be configured for scheduling Figure 3 The query execution plan set 331 includes at least the options for executing the first query 311 to access Figure 4 The first query execution plan 321 of the first dataset 411 of data 400 in RDBS 300 includes a second query execution plan 322 for executing a second query 312 to access the second dataset 412 of data 400. Data 400 can be divided into data blocks 410 of the datasets of data 400. The metadata 304 of RDBS 300 includes information about at least one characteristic of the datasets in each data block 410. Data blocks 410 include, for example, a first data block 410-1, a second data block 410-2, a third data block 410-3, a fourth data block 410-4, a fifth data block 410-5, and a sixth data block 410-6, with the datasets of data blocks 410 being... Figure 4 It is represented in the form of a box.
[0069] The first operation includes determining that the first partition 401 of data block 410 is potentially being accessed when the first query execution plan 321 is executed on RDBS 300 based on metadata 304 and conditions that the first dataset 411 must satisfy according to the first query 311 (hereinafter referred to as the first condition).
[0070] The second operation includes determining that the second partition 402 of data block 410 is potentially being accessed when the second query execution plan 322 is executed on RDBS 300 based on metadata 304 and conditions that the second dataset 412 must satisfy according to the second query 312 (hereinafter referred to as the second conditions).
[0071] The third operation includes performing a check to see if there is a common partition between the data blocks of the first partition 401 and the second partition 402.
[0072] The fourth operation includes scheduling the first query execution plan 321 and the second query execution plan 322 on RDBS 300 based on the inspection results.
[0073] The fifth operation includes determining the first partition 401 based on metadata 304 and a first condition by discarding the first complementary partition 701 of data block 410.
[0074] The sixth operation includes determining the second partition 402 by discarding the second complementary partition 702 of data block 410 based on metadata 304 and second conditions.
[0075] The processor 16 can execute the first, second, third, fourth, fifth, and sixth operations by executing the first program module 41, the second program module 42, the third program module 43, the fourth program module 44, the fifth program module 45, and the sixth program module 46, respectively. The first processor 102 can execute the main program 51, which initiates the execution of program modules 41, 42, 43, 44, 45, and 46 on the processor 16.
[0076] Computer system 10 can be a standalone computer without a network connection, which can receive data to be processed, such as first plan 321 and second plan 322, through a local interface. However, this operation can also be performed using a computer system connected to a communication network and / or computing network.
[0077] Figure 2An exemplary computing environment is illustrated, in which a computer system, such as computer system 10, is connected to network 200, for example, using network adapter 20. RDBS 300 includes network 200 and can also be considered as a computer system, such as computer system 10. RDBS 300, and preferably components of RDBS 300, such as query compiler 302, include components similar to those of computer system 10, such as one or more processors or processing units, such as processor 16, system memory, such as system memory 28, and buses, such as bus 18 connecting various system components. Without limitation, network 200 can be a communication network such as the Internet, a local area network (LAN), a wireless network such as a mobile communication network, etc. Network 200 includes computing networks such as cloud computing networks. Computer system 10 can receive data to be processed from network 200, such as first schedule 321 and second schedule 322, and / or can provide computation results, such as a schedule table 600 including at least the execution order of first schedule 321 and second schedule 322, to another computing device connected to computer system 10 via network 200.
[0078] Computer system 10 can perform all or part of the operations described herein, such as the first, second, third, fourth, fifth, and sixth operations, in response to a request received via network 200. Specifically, computer system 10 can perform such operations in a distributed computing environment with one or more other computer systems connected to it via network 200. For this purpose, computing system 10 and / or any other involved computer systems can use network 200 to access additional computing resources, such as dedicated or shared memory.
[0079] according to Figure 4 In the example shown, data 400 can be stored in the form of a data table 420. Data table 420 includes rows and columns 430. These rows can each indicate a single dataset of data 400, and are also often referred to as data records. Therefore, in Figure 4 In the middle, as each dataset moves along vertical arrow 421, the number of rows can increase by one; however, in Figure 4 In the example, Table 420 may not have row indexes. Columns 430 may each specify different characteristics. For example, regarding the corresponding row, the first column 431 may specify the corresponding individual's date of birth, the second column 432 may specify the corresponding individual's last name, the third column 433 may specify the corresponding individual's first name, and the fourth column 434 may specify the corresponding individual's credit account balance. Therefore, according to this example, Table 420 can represent a bank account database. Each dataset includes the same number of entries as the number of columns 430. Each entry in a dataset is indexed in... Figure 4The information is indicated in boxes, where the individual's birth date can be given by the month of birth, followed by the day of birth.
[0080] In the following example, an example may be presented where the relevant information regarding the characteristics of the dataset of the corresponding data block 410 can be the range of the corresponding data block 410, indicating the range in which the data values of the dataset of the corresponding data block 410 lie. The corresponding range can be defined by the corresponding minimum data value in the corresponding data block 410-1 and the corresponding maximum data value in the corresponding data block 410-N.
[0081] Furthermore, an example based on the presented figures can represent a variant in which the range of the corresponding data blocks 410-N is defined by the corresponding minimum data value of the first column 431 of the data table 420 within the corresponding data blocks 410-N and the corresponding maximum data value of the first column 431 of the data table 420 within the corresponding data blocks 410-N.
[0082] Metadata 304 includes the range of each data block 410. Metadata 304 can be stored in the form of a table and includes... Figure 5 The values given in Table 500, as shown, are based on Data Table 420, which comprises six data blocks. Table 500 consists of six rows. In the corresponding rows of Table 500, the earliest and latest birth dates given by the datasets of the corresponding data blocks 410-N can be stored. For simplicity, only the month and day of the birth date are considered. The metadata 304 given by Table 500 can correspond to an example where the dataset can be sorted relative to the data values in the first column 431, and therefore relative to the individual's birth date. However, this may not be the case in other applications. Typically, the choice of the data types described above, such as birthday and name, is only used to explain the proposed method in a simple way. Of course, regarding other possible applications, Data 400 could involve technical data values, such as coefficients of material properties or data used to specify chemical elements, their behavior, or chemical reactions.
[0083] A simple first application of this method can be applied to lotteries, including the use of a random number generator. The random number generator produces a first set of data values for specifying random birth dates. The first set includes a first birth date and a second birth date. An individual whose birth date equals one of the random birth dates in the first set receives $100. The first query 311, which implements the winning entry for the credit accounts of individuals given the first set of random birth dates, can be formulated in SQL as follows:
[0084] "Update data table 420"
[0085] Set balance of credit account=balance of credit account+100$
[0086] Where birth date='first birth date'OR'second birth date'"
[0087] The first predicate "birth date = 'first birth date' OR 'second birth date'" can represent the first condition that must be satisfied according to the first query 311 and the first dataset 411.
[0088] The lottery may involve creating a second set of random birth dates using a random number generator. This second set includes a third and a fourth set of birth dates. An individual whose birth date equals one of the random birth dates in the second set receives $100. The second query 312, which implements winning on the credit account of an individual given a random birth date from the second set, can be formulated in SQL as follows:
[0089] "Update data table 420"
[0090] Set balance of credit account=balance of credit account+100$
[0091] Where birth date='third birth date'OR 'fourth birth date'"
[0092] The second predicate "birth date = 'third birth date' OR 'fourth birth date'" can represent the second condition that must be satisfied according to the first query 311 and the second data set 412.
[0093] The query compiler can compile the first and second queries 311 and 312 into a first plan 321 and a second plan 322, respectively. The first plan 321 includes values for specifying the first and second random birth dates and a first executable program containing instructions for updating a dataset (i.e., the first dataset 411) that satisfies a first condition. These instructions include, for example, a first load command for loading all datasets in the first partition 401 and a first comparison command for initiating comparisons to test the first condition for the datasets in the first partition 401.
[0094] Similarly, the second plan 322 includes values for specifying third and fourth random birth dates and a second executable program containing instructions for updating the dataset (i.e., the second dataset 412) that satisfies the second condition. These instructions include, for example, a second load command for loading all datasets in the second partition 402 and a second comparison command for initiating comparisons to test the second condition for the datasets in the second partition 402.
[0095] In the first use case of this method, the first random birth date is "02.02.", the second random birth date is "01.07.", the third random birth date is "02.10.", and the fourth random birth date is "10.12.".
[0096] Query compiler 302 can use metadata 304 (in this case, table 500; in another case, table 1000)), first and second random birth dates, and a first predicate to generate a first load command to load all datasets in the first partition 401. Query compiler 302 can use the first and second random birth dates and metadata 304 to infer that the first dataset 411 can only be stored in the first data block 410-1 and the third data block 410-3. Similarly, query compiler 302 can generate a second load command to load all datasets in the second partition 402 using metadata 304, third and fourth random birth dates, and a second predicate. Query compiler 302 can use the third and fourth random birth dates and metadata 304 to infer that the second dataset 412 can only be stored in the fifth data block 410-5 and the sixth data block 410-6. The first plan 321 and the second plan 322 can be passed from query compiler 302 to stack 303.
[0097] According to the first use case, when executing the first plan 321, the first partition 401 of the potentially accessed dataset includes the first data block 410-1 and the third data block 410-3. Furthermore, considering the first use case, when executing the second plan 322, the second partition 402 of the potentially accessed dataset includes the fifth data block 410-5 and the sixth data block 410-6. Therefore, the first use case can represent the case where the first partition 401 and the second partition 401 do not intersect. Figure 4 The possible distributions of the first dataset 411 and the second dataset 412 are shown, as well as the possible composition of the first partition 401 and the second partition 402 for the first use case.
[0098] The workload manager 301 can receive information from the query optimizer 302 to specify the first partition 401 and the second partition 402. In this example, the determination of the first and second partitions 401, 402 can be performed by a remote device, here the query compiler 302, which is associated with the workload manager 301. If there is a common partition for the data blocks of the first partition 401 and the second partition 402, the workload manager 301 can perform a check. Considering the first use case, the result of this check could be that there is no common partition. In this case, the workload manager 301 can schedule the first schedule 321 and the second schedule 322 so that the first schedule 321 and the second schedule 322 are executed in parallel on the RDBS 300. To achieve this, the workload manager 301 can generate a scheduling table 600 such that the first schedule 321 and the second schedule 322 are scheduled to run in parallel, as follows: Figure 6 As shown, scheduling table 600 determines which computing unit in the rack of computing unit 340 of RDBS 300 can execute which execution plan in execution plan set 331. Rack 340 includes, for example, a first computing unit 341, a second computing unit 342, a third computing unit 343, a fourth computing unit 344, and a fifth computing unit 345. The scheduling includes a queue for each computing unit in rack 340, namely, a first queue 601 for the first computing unit 341, a second queue 602 for the second computing unit 342, and so on.
[0099] The first and second plans 321 and 322 can be considered as computational tasks of the computing unit, and... Figure 6 It is shown in the form of a box. Figure 6 Unmarked boxes may indicate additional computational jobs that can also be scheduled by workload manager 301. In the first use case, scheduler 600 can determine that first schedule 321 will be executed by first computation unit 341 and second schedule 322 will be executed by second computation unit 342, with schedules 321 and 322 being scheduled at least partially in parallel. Therefore, for the first use case, scheduler 600 is designed such that first schedule 321 and second schedule 322 have time overlap. In one example, first schedule 321 and second schedule 322 may be scheduled to start simultaneously.
[0100] The left portion of one of the corresponding queues indicates the actual computational job that was assigned to the corresponding computational unit. The queues extend from left to right, showing the jobs to be executed by each computational unit in chronological order, with the corresponding last job for each computational unit shown on the right side of each corresponding queue.
[0101] The computing unit of rack 340 can access the database server 306 of RDBS 300, which includes various data tables, including data table 420 for executing execution plans in set 331, including first plan 321 and second plan 322.
[0102] In one example, the workload manager 301 can receive information from the query optimizer 302 regarding whether the first partition 401 and the second partition 402 are disjoint. In this example, the workload manager 301 can simply perform the generation of the scheduling table 600, and the query compiler 302 can perform the other steps of the proposed method.
[0103] In the first use case, the workload manager 301 can disable the locking mechanism of RDBS. The locking mechanism can be configured to lock at least a portion of the first partition 401 and / or the second partition 402 of the data blocks. Locking of these data blocks may result in a situation where, at any given time, these data blocks can only be accessed by the execution of a single query execution plan (e.g., the first plan 321 or the second plan 322).
[0104] In the second use case of this method, the first random birth date is "02.02.", the second random birth date is "01.07.", the third random birth date is "10.07.", and the fourth random birth date is "10.12.".
[0105] According to the second use case, when executing the first plan 321, the first partition 401 of the potentially accessed dataset includes the first data block 410-1 and the third data block 410-3. Furthermore, considering the first use case, when executing the second plan 322, the second partition 402 of the potentially accessed dataset includes the third data block 410-3 and the sixth data block 410-6. Therefore, the second use case can represent the case where the first partition 401 and the second partition 401 are not disjoint. Figure 7 The possible distributions of the first dataset 411 and the second dataset 412 are shown, as well as the possible compositions of the first partition 401 and the second partition 402 for the second use case.
[0106] Similar to the first use case, workload manager 301 can perform a check in the second use case to determine if a common partition exists for the data blocks of first partition 401 and second partition 402. Considering the second use case, the result of this check could be the existence of a common partition. The common partition includes third data blocks 410-3. In this case, according to the first variant, workload manager 301 can schedule first schedule 321 and second schedule 322 such that the result of first schedule 321 is available in the cache of RDBS 300 for use of second schedule 322. One way to achieve this is for workload manager 301 to generate a scheduling table 600 such that second schedule 322 is scheduled in the same queue as first schedule 321, for example, a first example according to the first variant is first queue 601. This allows the dataset of the data blocks of first partition 401 to be stored in the cache of first computing unit 341 after first computing unit 341 has executed first schedule 321 and when first computing unit 341 executes second schedule 322. Figure 8 The schedule table 600 generated by the workload manager 301 is shown as a first example of a first variant of the second use case.
[0107] Similarly, if both plans 321 and 322 are scheduled in the second queue 602, this allows the dataset of the data blocks of the first partition 401 to be stored in the cache of the second computing unit 342 after the second computing unit 342 has executed the first plan 321 and when the second computing unit 342 executes the second plan 322.
[0108] According to a second example of a first variant of the second use case, workload manager 301 can schedule first schedule 321 and second schedule 322 such that first schedule 321 and second schedule 322 are scheduled to run immediately after each other. One way to achieve this is for workload manager 301 to generate schedule table 600 such that second schedule 322 is scheduled in the same queue as first schedule 321, which immediately follows first schedule 321, for example, in first queue 601. Figure 9 A scheduling table 600 generated by the workload manager 301 is shown as a second example of a first variant of the second use case. Furthermore, Figure 9 An example of a schedule table 600 is described, in which a first schedule 321 runs at an actual time, while a second schedule 322 is scheduled to start at a future time. However, according to another example, for the purpose of representing a second example of a first variant of a second use case, the first schedule 321 does not necessarily need to run at an actual time.
[0109] Typically, considering all the use cases, variations, and examples described above, in one example, workload manager 301 can send schedule 600 to the job manager at rack 340. In another example, workload manager 301 can use schedule 600 to initiate computational jobs on rack 340, such as first schedule 321 and / or second schedule 322. In one example, rack 340 includes workload manager 301. In this case, workload manager 301 can control and record computational jobs on rack 340.
[0110] Further variations can be described below, where the dataset is not sorted by birth date as described above. In this case, the metadata 304 regarding the first column can be included. Figure 10 The values given in Table 1000 are based on data table 420, which comprises six data blocks. Table 1000 consists of six rows. In the corresponding rows of Table 500, the earliest and latest birth dates given by the datasets of the corresponding data blocks 410-N can be stored.
[0111] In another variant, according to the first use case, where the first random birth date is "02.02," the second random birth date is "01.07," the third random birth date is "02.10," and the fourth random birth date is "10.12," the first partition 401 of the dataset potentially accessible under the execution of the first plan 321 includes the first data block 410-1, the second data block 410-2, and the third data block 410-3. Furthermore, considering the other variant and the first use case, the second partition 402 of the dataset potentially accessible under the execution of the second plan 322 includes the fourth data block 410-4, the fifth data block 410-5, and the sixth data block 410-6. Therefore, considering the other variant, the first use case can also represent the case where the first partition 401 and the second partition 401 are disjoint. Figure 11 The possible distributions of the first dataset 411 and the second dataset 412, considering other variations and the first use case, are shown, as well as the possible compositions of the first partition 401 and the second partition 402.
[0112] In another variation, determining the first partition 401 includes a first complementary partition 701 based on metadata 304 and a first condition for discarding data block 410. The first complementary partition 701 may represent a data block of data block 410 that is not being accessed when the first plan 321 is executed on the RDBS 300. Furthermore, determining the second partition 402 includes a second complementary partition 702 based on metadata 304 and a second condition for discarding data block 410. The second complementary partition 702 may represent a data block of data block 410 that is not being accessed when the second plan 322 is executed on the RDBS 300.
[0113] The workload manager 301 or query compiler 302 can use the metadata 304 given in table 1000, the first and second random birth dates, and the first predicate to perform the discarding of the first complementary partition 701. Similarly, the workload manager 301 or query compiler 302 can use the metadata 304 given in table 1000, the third and fourth random birth dates, and the second predicate to perform the discarding of the second complementary partition 702. For example, if the first and second random birth dates are not within the range of the corresponding data blocks 410-N given in table 1000, then data blocks 410-N can be discarded to determine the first partition 401. According to the first use case, the first complementary partition 701 includes the fourth data block 410-4, the fifth data block 410-5, and the sixth data block 410-6, and then the first partition 401 can be determined as the set of data blocks including data block 410 without the first complementary partition 701. Similarly, the second complementary partition 702 can be determined, and the second partition 402 is based on the second complementary partition 702.
[0114] In another variant of the first use case, where the first partition 401 and the second partition 402 are not intersecting, i.e., there is no common partition between the first partition 401 and the second partition 402, the workload manager 301 may perform scheduling similar to the variant of the first use case, where the dataset is sorted relative to the birth date.
[0115] Considering another variant and a second use case, where the first random birth date is "02.02," the second random birth date is "01.07," the third random birth date is "10.07," and the fourth random birth date is "10.12," the first partition 401 of the dataset potentially accessible under the execution of the first plan 321 includes the first data block 410-1, the second data block 410-2, and the third data block 410-3. Furthermore, considering another variant and the second use case, the second partition 402 of the dataset potentially accessible under the execution of the second plan 322 includes all data blocks 410. Therefore, considering another variant, the second use case can also represent the case where the first partition 401 and the second partition 401 are not disjoint. Figure 12 Possible distributions of the first dataset 411 and the second dataset 412, considering other variations and the second use case, as well as possible compositions of the first partition 401 and the second partition 402, are shown.
[0116] In another variant of the second use case, the first partition 401 and the second partition 402 are not disjoint, i.e., there is a common partition between the first partition 401 and the second partition 402, and the workload manager 301 can perform scheduling similar to the variant of the second use case, where the dataset is sorted relative to the birth date.
[0117] Figure 13 A flowchart is shown of a computer-implemented method for scheduling a set 331 of query execution plans.
[0118] In step 1001, based on metadata 304 and a first condition, the first partition 401 of the data block that is potentially being accessed when the first query execution plan 321 is executed on RDBS 300 can be determined.
[0119] In step 1002, based on metadata 304 and the second condition, the second partition 402 of the data block that is potentially being accessed when the second query execution plan 322 is executed on RDBS 300 can be determined.
[0120] In step 1003, a check can be performed to see if there is a common partition between the data blocks of the first partition 401 and the second partition 402.
[0121] In step 1004, the first query execution plan 321 and the second query execution plan 322 can be scheduled on RDBS 300 based on the inspection results.
[0122] This disclosure can be a system, method, and / or computer program product at any possible level of technical detail integration. A computer program product may include a computer-readable storage medium (or media) having computer-readable program instructions thereon for causing a processor to execute aspects of this disclosure. The computer-readable storage medium may be a tangible device capable of retaining and storing instructions used by an instruction execution device.
[0123] Computer-readable storage media can be, for example, but not limited to, electronic storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination of the foregoing. A non-exhaustive list of more specific examples of computer-readable storage media includes the following: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable optical disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices such as punch cards or recessed structures with instructions recorded thereon, and any suitable combination of the foregoing. As used herein, computer-readable storage media should not be construed as transient signals themselves, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., light pulses through fiber optic cables), or electrical signals transmitted through wires.
[0124] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to a suitable computing / processing device, or via a network, such as the Internet, a local area network (LAN), a wide area network (WAN), and / or a wireless network, to an external computer or external storage device. Networks include copper cables, optical fibers, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to a computer-readable storage medium within the respective computing / processing device.
[0125] Computer-readable program instructions used to perform the operations of this disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine-dependent instructions, microcode, firmware instructions, status setting data, integrated circuit configuration 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 procedural programming languages (such as the "C" programming language or similar programming languages). The computer-readable program instructions may execute entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the latter case, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry including, for example, programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs) may execute computer-readable program instructions by utilizing status information from the computer-readable program instructions to personalize the electronic circuitry in order to perform aspects of this disclosure.
[0126] This document describes aspects of the disclosure with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the disclosure. It will be understood that each block of the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, can be implemented by computer-readable program instructions.
[0127] These computer-readable program instructions may be provided to a processor of a computer or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions / actions specified in one or more blocks of a flowchart and / or block diagram. These computer-readable program instructions may also be stored in a computer-readable storage medium that can direct a computer, programmable data processing apparatus, and / or other devices to operate in a particular manner, such that the computer-readable storage medium in which the instructions are stored includes an article of writing comprising instructions for implementing aspects of the functions / actions specified in one or more blocks of a flowchart and / or block diagram.
[0128] 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 produce a computer-implemented process, such that the instructions, which execute on the computer, other programmable apparatus or other device, perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.
[0129] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of instructions comprising one or more executable instructions for implementing a specified logical function. In some alternative embodiments, the functions indicated in the blocks may occur in a non-linear order as shown in the figures. For example, two blocks shown consecutively may actually be implemented as a single step, executed simultaneously, substantially simultaneously, with partial or complete time overlap, or these blocks may sometimes be executed in reverse order, depending on the functions involved. It will also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a dedicated hardware-based system that performs the specified function or action or executes a combination of dedicated hardware and computer instructions.
[0130] The disclosure will be described again below by a list of terms highlighting several possible, non-exclusive combinations of the features disclosed herein:
[0131] A computer-implemented method for scheduling a set of query execution plans, the set of query execution plans including at least a first query execution plan for executing a first query on a first dataset for accessing data in a relational database system (RDBS), and a second query execution plan for executing a second query on a second dataset for accessing said data, said data being divided into data blocks of said data datasets, wherein said RDBS metadata includes corresponding information about at least one characteristic of said dataset for each data block, the method comprising:
[0132] When the first query execution plan is executed on the RDBS based on the metadata and the conditions that the first dataset must satisfy according to the first query, it is determined that the first partition of the data block is being accessed;
[0133] When the second query execution plan is executed on the RDBS based on the metadata and another condition that the second dataset must satisfy according to the second query, it is determined that the second partition of the data block is being accessed;
[0134] If a common partition exists between the data blocks of the first partition and the second partition, then perform a check;
[0135] Based on the results of the inspection, the first query execution plan and the second query execution plan are scheduled on the RDBS.
[0136] According to the method described in Clause 1, determining the first partition includes discarding a first complementary partition of the data block based on the metadata and the conditions that the first dataset must satisfy for the first query, the first complementary partition of the data block indicating that the data block of the data is not being accessed when the first query execution plan is executed on the RDBS, and determining the second partition includes discarding a second complementary partition of the data block using the metadata and the conditions that the second dataset must satisfy for the second query, the second complementary partition of the data block indicating that the data block of the data is not being accessed when the second query execution plan is executed on the RDBS.
[0137] According to the method described in Clause 1 or 2, the method further includes scheduling the first query execution plan and the second query execution plan such that if there is no common partition for the data blocks of the first partition and the second partition, the first query execution plan and the second query execution plan are executed in parallel on the RDBS.
[0138] According to the method described in Clause 1 or 2, the method further includes scheduling the first query execution plan and the second query execution plan such that if there is a common partition of data blocks of the first partition and the second partition, the result of the first query execution plan is available in the cache of the RDBS for use by the second query execution plan.
[0139] The method according to Clause 1, 2 or 3 further includes disabling a locking mechanism of RDBS for locking at least a portion of a first partition and a second partition of a data block, the locking mechanism causing the data blocks to be accessible only by the execution of a single query execution plan at any given time, wherein the locking mechanism is disabled if the data blocks of the first and second partitions do not share a common partition.
[0140] The method according to Clause 1, 2 or 4 further includes activating a locking mechanism of RDBS for locking data blocks of a common partition such that these data blocks can only be accessed by the execution of a single query execution plan at any given time, wherein the locking mechanism is activated if there is a common partition of data blocks of the first partition and the second partition.
[0141] According to one of the methods described in the foregoing clauses, the relevant information regarding the characteristics of the dataset of the corresponding data block is the range of data values in the dataset of the corresponding data block, which is defined by the minimum data value and the maximum data value in the corresponding data block.
[0142] According to the method described in Clause 7, the data in the RDBS is stored in the RDBS using data tables, and the range is defined by the minimum data value in the column of the data table in the corresponding data block and the maximum data value in the column of the data table in the corresponding data block, the corresponding data block indicating the corresponding block of the row of the data table.
[0143] According to the method described in any one of the preceding clauses 1 to 6, the characteristic of the dataset is the distribution of the data values of the dataset within the corresponding data blocks, and the corresponding information about the characteristics of the dataset in the corresponding data blocks describes the distribution of the data values.
[0144] According to the method described in Clause 9, the data in the RDBS is stored in the RDBS using data tables, and the distribution refers to the distribution of data values in the columns of the data tables within the corresponding data blocks, and the corresponding information about the characteristics of the dataset of the corresponding data blocks describes the distribution of data values in the columns of the data tables within the corresponding data blocks, with the corresponding data blocks indicating the corresponding blocks of rows in the data tables.
[0145] The method described according to Clause 9 or 10, wherein the distribution is represented by a density vector.
[0146] According to one of the methods described in the foregoing clauses, one of the two query execution plans, namely the first query execution plan or the second query execution plan, runs at an actual time, and the other of the two query execution plans is scheduled to start at a future time.
[0147] The method described according to clauses 1, 2, 4, 6, 7, 8, 9, 10, 11 or 12, wherein the first query execution plan and the second query execution plan are scheduled to run immediately after each other.
[0148] The method according to one of the foregoing clauses further includes receiving the metadata from the query optimizer of the RDBS.
[0149] According to one of the preceding clauses, the method further includes receiving information from the query optimizer of the RDBS for specifying the first partition and the second partition.
[0150] According to one of the preceding clauses, the method further includes setting boundary conditions for running the query optimizer of the RDBS such that the common partition is empty.
[0151] A computer program product includes a computer-readable storage medium having computer-readable program code embodied therein, the computer-readable program code being configured to implement the method according to any one of the preceding clauses.
[0152] A computer system for scheduling a set of query execution plans, the set of query execution plans including at least a first query execution plan for executing a first query and a second query execution plan for executing a second query, the first query for accessing a first dataset of data in a relational database system (RDBS), the second query for accessing a second dataset of the data, the data being divided into data blocks of the dataset, wherein the metadata of the RDBS includes corresponding information about at least one characteristic of the dataset of the corresponding data block, the computer system being configured to: determine that a first partition of the data block is being accessed when the first query execution plan is executed on the RDBS based on the metadata and according to a condition that the first dataset of the first query must satisfy; determine that a second partition of the data block is being accessed when the second query execution plan is executed on the RDBS based on the metadata and according to another condition that the second dataset of the second query must satisfy; perform a check if a common partition exists between the data blocks of the first partition and the second partition; and schedule the first query execution plan and the second query execution plan on the RDBS based on the result of the check.
Claims
1. A computer-implemented method for scheduling a set of query execution plans, the set of query execution plans being compiled by a query compiler, the set of query execution plans including at least a first query execution plan for executing a first query and a second query execution plan for executing a second query, the first query being for accessing a first dataset of data in a relational database system (RDBS), the second query being for accessing a second dataset of the data, the data being divided into data blocks of the dataset, wherein the metadata of the RDBS includes information about the distribution of data values of the dataset in corresponding data blocks within the data blocks, the corresponding data blocks corresponding to a certain amount of physical space in the RDBS, the method comprising: When the first query execution plan is executed on the RDBS based on the metadata and the conditions that the first dataset must satisfy according to the first query, a first partition of the data block that will be potentially accessed is determined, wherein the determination includes discarding a first complementary partition of the data block based on the metadata and the conditions of the first data, the first complementary partition of the data block indicating that the data block of the data is not being accessed when the first query execution plan is executed on the RDBS; When the second query execution plan is executed on the RDBS based on the metadata and another condition that the second dataset must satisfy according to the second query, a second partition of the data block that will be potentially accessed is determined, wherein the determination includes discarding a second complementary partition of the data block based on the metadata and the condition of the second data, the second complementary partition of the data block indicating that the data block of the data is not being accessed when the second query execution plan is executed on the RDBS; The workload manager examines the first partition and the second partition of the data block to determine whether there is a common partition between the data blocks of the first partition and the second partition, which prevents the first query execution plan and the second query execution plan from being executed in parallel on the RDBS, wherein the common partition of the data block is identified when the first partition and the second partition of the data block are disjoint; The workload manager generates a schedule based on the check, wherein parallel execution of the first query execution plan and the second query execution plan is permitted when the public partition does not exist, and the schedule instructs the execution of the first query execution plan and the second query execution plan. as well as Based on the scheduling, the first query execution plan and the second query execution plan are scheduled on the RDBS.
2. The method according to claim 1, further comprising: The first query execution plan and the second query execution plan are scheduled such that when the common partition of the data blocks of the first partition and the second partition does not exist, the first query execution plan and the second query execution plan are executed in parallel on the RDBS.
3. The method according to claim 1, further comprising: The first query execution plan and the second query execution plan are scheduled such that when a common partition exists for the data blocks of the first partition and the second partition, the result of the first query execution plan is available in the cache memory of the RDBS for use by the second query execution plan.
4. The method according to claim 1, further comprising: The locking mechanism of the RDBS is disabled, which is used to lock at least a portion of the first partition and the second partition of the data block, and the locking mechanism causes the data blocks to be accessible only by the execution of a single query execution plan at any given time, wherein the locking mechanism is disabled if there is no common partition between the data blocks of the first partition and the second partition.
5. The method according to claim 1, further comprising: Activating the locking mechanism of the RDBS ensures that the data block is accessed by only a single query execution plan at any given time. The locking mechanism is used to lock the data block of the common partition, wherein the locking mechanism is activated when a common partition exists for the data blocks of the first partition and the second partition.
6. The method of claim 1, wherein the corresponding information is the range of data values in the dataset of the corresponding data block, the range being defined by the minimum data value and the maximum data value in the corresponding data block.
7. The method of claim 6, wherein the data of the RDBS is stored in the RDBS by using a data table, and the range is defined by the minimum data value in a column of the data table in the corresponding data block and the maximum data value in a column of the data table in the corresponding data block, the corresponding data block indicating a corresponding block of rows of the data table.
8. The method of claim 1, wherein the corresponding information describes the distribution of the data values.
9. The method of claim 8, wherein the data of the RDBS is stored in the RDBS using a data table, and the distribution refers to the distribution of the data values in the columns of the data table within the corresponding data block, and the corresponding information describes the distribution of the data values in the columns of the data table within the corresponding data block, the corresponding data block indicating a corresponding block of rows of the data table.
10. The method of claim 8, wherein the distribution is represented by a density vector.
11. The method of claim 1, wherein one of the two query execution plans, the first query execution plan or the second query execution plan, is running at an actual time, and the other of the two query execution plans is scheduled to start at a future time.
12. The method of claim 3, wherein the first query execution plan and the second query execution plan are scheduled to run immediately after each other.
13. The method according to claim 1, further comprising: The metadata is received from the query optimizer of the RDBS.
14. The method according to claim 1, further comprising: The query optimizer of the RDBS receives information for specifying the first partition and the second partition.
15. The method according to claim 1, further comprising: Set boundary conditions for the query optimizer used to run the RDBS such that the common partition is empty.
16. A computer program product for scheduling a set of query execution plans, the set of query execution plans being compiled by a query compiler, the set of query execution plans including at least a first query execution plan for executing a first query and a second query execution plan for executing a second query, the first query being for accessing a first dataset of data in a relational database system (RDBS), the second query being for accessing a second dataset of the data, the data being divided into data blocks of the dataset, wherein the metadata of the RDBS includes information about the distribution of data values of the dataset in the corresponding data blocks, the corresponding data blocks corresponding to a certain amount of physical space in the RDBS, the computer program product comprising: One or more computer-readable storage media, and program instructions stored on the one or more computer-readable storage media, the program instructions comprising: Used to determine a first partition of the data block that will be potentially accessed when the first query execution plan is executed on the RDBS based on the metadata and the conditions that the first dataset must satisfy according to the first query, wherein the determination includes discarding a first complementary partition of the data block based on the metadata and the conditions of the first data, the first complementary partition of the data block indicating that the data block of the data is not being accessed by program instructions when the first query execution plan is executed on the RDBS; Used to determine a second partition of the data block that will be potentially accessed when the second query execution plan is executed on the RDBS based on the metadata and another condition that the second dataset must satisfy according to the second query, wherein the determination includes discarding a second complementary partition of the data block based on the metadata and the condition of the second data, the second complementary partition of the data block representing a data block of the data that is not being accessed by program instructions when the second query execution plan is executed on the RDBS; The workload manager examines the first and second partitions of the data block to determine if there is a common partition between the first and second partitions of the data block, which prevents the first query execution plan and the second query execution plan from being executed in parallel on the RDBS, wherein the common partition of the data block is identified when the first partition and the second partition of the data block are not intersecting. The workload manager generates a schedule based on the check, wherein parallel execution of the first query execution plan and the second query execution plan is permitted when the public partition does not exist, and the schedule indicates program instructions to execute the first query execution plan and the second query execution plan; and Program instructions for scheduling the first query execution plan and the second query execution plan on the RDBS based on the scheduling.
17. A computer system for scheduling a set of query execution plans, the set of query execution plans being compiled by a query compiler, the set of query execution plans including at least a first query execution plan for executing a first query and a second query execution plan for executing a second query, the first query being for accessing a first dataset of data in a relational database system (RDBS), the second query being for accessing a second dataset of the data, the data being divided into data blocks of the dataset, wherein the metadata of the RDBS includes information about the distribution of data values of the dataset in the corresponding data blocks, the corresponding data blocks corresponding to a certain amount of physical space in the RDBS, the computer system being configured to: When the first query execution plan is executed on the RDBS based on the metadata and the conditions that the first dataset must satisfy according to the first query, a first partition of the data block that will be potentially accessed is determined, wherein the determination includes discarding a first complementary partition of the data block based on the metadata and the conditions of the first data, the first complementary partition of the data block indicating that the data block of the data is not being accessed when the first query execution plan is executed on the RDBS; When the second query execution plan is executed on the RDBS based on the metadata and another condition that the second dataset must satisfy according to the second query, a second partition of the data block that will be potentially accessed is determined, wherein the determination includes discarding a second complementary partition of the data block based on the metadata and the condition of the second data, the second complementary partition of the data block indicating that the data block of the data is not being accessed when the second query execution plan is executed on the RDBS; The workload manager examines the first partition and the second partition of the data block to determine whether there is a common partition between the data blocks of the first partition and the second partition, which prevents the first query execution plan and the second query execution plan from being executed in parallel on the RDBS, wherein the common partition of the data block is identified when the first partition and the second partition of the data block are disjoint; The workload manager generates a schedule based on the check, wherein parallel execution of the first query execution plan and the second query execution plan is permitted when the public partition does not exist, and the schedule instructs the execution of the first query execution plan and the second query execution plan. as well as Based on the scheduling, the first query execution plan and the second query execution plan are scheduled on the RDBS.
18. The computer system of claim 17, further configured to: The first query execution plan and the second query execution plan are scheduled such that when the common partition of the data blocks of the first partition and the second partition does not exist, the first query execution plan and the second query execution plan are executed in parallel on the RDBS.
Citation Information
Patent Citations
Method and apparatus for generating database partition execution plans
CN102262636A
Partitioned management method for multi-tenant shared data table, server and system
CN104216893A
Database system and data processing method
JP2018101217A
Efficient index-data fetch via callback for table data
US20010037322A1
Database early parallelism method and system
US20050131893A1