+

CN103064955A - Inquiry planning method and device - Google Patents

Inquiry planning method and device Download PDF

Info

Publication number
CN103064955A
CN103064955A CN2012105863060A CN201210586306A CN103064955A CN 103064955 A CN103064955 A CN 103064955A CN 2012105863060 A CN2012105863060 A CN 2012105863060A CN 201210586306 A CN201210586306 A CN 201210586306A CN 103064955 A CN103064955 A CN 103064955A
Authority
CN
China
Prior art keywords
query
path
query path
execution
memory
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN2012105863060A
Other languages
Chinese (zh)
Inventor
秦君华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN2012105863060A priority Critical patent/CN103064955A/en
Publication of CN103064955A publication Critical patent/CN103064955A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本发明实施例提供一种查询规划方法及装置,查询规划方法包括:接收查询请求消息;根据查询请求消息的操作对象确定至少一个查询路径,每个查询路径包括至少一个查询操作步骤;针对各查询路径,确定每个查询路径的执行代价;确定执行代价最小的查询路径为最优查询路径;根据当前各个存储器的运算能力,按照设定规则选择执行查询操作步骤的存储器;将最优查询路径分配给执行器调度给各个存储器执行。本发明实施例的查询规划方法及装置能够实现由按照最优查询路径规划时确定的存储器执行该最优查询路径的各个步骤获得的查询结果,可以保证通过该最优查询路径获得查询结果实际上付出的执行代价最小。

Figure 201210586306

Embodiments of the present invention provide a query planning method and device. The query planning method includes: receiving a query request message; determining at least one query path according to the operation object of the query request message, and each query path includes at least one query operation step; for each query Path, determine the execution cost of each query path; determine the query path with the smallest execution cost as the optimal query path; select the memory that executes the query operation steps according to the set rules according to the current computing power of each memory; allocate the optimal query path The executor is dispatched to each memory for execution. The query planning method and device of the embodiments of the present invention can realize the query results obtained by executing each step of the optimal query path according to the memory determined during the optimal query path planning, and can ensure that the query results obtained through the optimal query path are actually The execution cost paid is minimal.

Figure 201210586306

Description

查询规划方法及装置Query planning method and device

技术领域technical field

本发明实施例涉及计算机数据库技术,尤其涉及一种查询规划方法及装置。Embodiments of the present invention relate to computer database technology, and in particular to a query planning method and device.

背景技术Background technique

客户端向数据库的主服务器发送查询请求以查询数据库中的数据时,主服务器通过“查询规划器”确定针对该查询请求的“最佳执行计划”,“查询规划器”在确定“最佳执行计划”时,通常先根据计算代价、读盘速度等因素确定可以实现该查询请求的执行步骤以及各个操作步骤之间的排序关系,生成至少一个“执行计划”,各个“执行计划”构成搜索空间,主服务器然后对该搜索空间中的“执行计划”分别进行代价估算,根据代价估算结果确定代价最小的“执行计划”作为针对该查询请求的“最佳执行计划”,主服务器的查询执行器顺序地执行该“最佳执行计划”得到查询结果,最后将查询结果通过主服务器反馈给发送查询请求的客户端。When the client sends a query request to the master server of the database to query the data in the database, the master server determines the "best execution plan" for the query request through the "query planner". When planning”, usually according to the calculation cost, disk reading speed and other factors, the execution steps that can realize the query request and the ordering relationship between each operation step are determined first, and at least one “execution plan” is generated, and each “execution plan” constitutes the search space , the master server then estimates the cost of the "execution plan" in the search space, and determines the "execution plan" with the least cost as the "best execution plan" for the query request according to the cost estimation results. The query executor of the master server Execute the "best execution plan" sequentially to obtain query results, and finally feed back the query results to the client that sent the query request through the master server.

当数据库中的数据分布在不同的存储设备上,即数据存储在分布式存储系统中时,为了生成针对查询请求的查询结果,需要多个不同的存储设备参与,然而传统的查询规划方法确定的“最佳执行计划”是在同一存储器的情况下顺序执行的,不能适用于分布式存储架构,得到执行代价最小的方案。When the data in the database is distributed on different storage devices, that is, when the data is stored in a distributed storage system, multiple different storage devices are required to participate in order to generate query results for query requests. However, traditional query planning methods determine The "best execution plan" is executed sequentially in the case of the same memory, which cannot be applied to the distributed storage architecture, and the plan with the least execution cost can be obtained.

发明内容Contents of the invention

本发明实施例提供一种查询规划方法及装置,旨在解决采用现有查询规划方法确定的“最佳执行计划”进行查询获取查询结果,实际上付出的执行代价不一定最小的问题。Embodiments of the present invention provide a query planning method and device, aiming at solving the problem that the actual cost of execution is not necessarily the smallest when using the "best execution plan" determined by the existing query planning method to query and obtain query results.

第一方面,本发明实施例提供一种查询规划方法,包括:In a first aspect, an embodiment of the present invention provides a query planning method, including:

接收查询请求消息;Receive query request message;

根据所述查询请求消息的操作对象确定至少一个查询路径,每个查询路径包括至少一个查询操作步骤;Determine at least one query path according to the operation object of the query request message, each query path includes at least one query operation step;

针对各所述查询路径,确定每个查询路径的执行代价,其中所述执行代价包括处理器执行时间、磁盘输入输出时间以及网络传输时间,所述网络传输时间为待处理数据在存储器之间传输所消耗的时间;For each of the query paths, determine the execution cost of each query path, wherein the execution cost includes processor execution time, disk input and output time, and network transmission time, and the network transmission time is the transmission of data to be processed between memories time spent;

确定执行代价最小的查询路径为最优查询路径;Determine the query path with the least execution cost as the optimal query path;

将所述最优查询路径分配给执行器调度给各个存储器执行。Allocating the optimal query path to an executor and scheduling each memory for execution.

结合第一方面,在第一方面的第一种可能的实现方式中,在根据所述查询请求消息的操作对象确定至少一个查询路径之前,还包括:With reference to the first aspect, in a first possible implementation manner of the first aspect, before determining at least one query path according to the operation object of the query request message, the method further includes:

根据当前各个存储器的运算能力,按照设定规则选择执行查询操作步骤的存储器。According to the current computing capability of each memory, the memory for executing the query operation step is selected according to the set rule.

第二方面,本发明实施例提供一种查询规划装置,包括:In a second aspect, an embodiment of the present invention provides a query planning device, including:

接收模块,用于接收查询请求消息;A receiving module, configured to receive a query request message;

查询规划模块,用于根据所述查询请求消息的操作对象确定至少一个查询路径,每个查询路径包括至少一个查询操作步骤;针对各所述查询路径,确定每个查询路径的执行代价,其中所述执行代价包括处理器执行时间、磁盘输入输出时间以及网络传输时间,所述网络传输时间为待处理数据在存储器之间传输所消耗的时间;确定执行代价最小的查询路径为最优查询路径;A query planning module, configured to determine at least one query path according to the operation object of the query request message, each query path includes at least one query operation step; for each of the query paths, determine the execution cost of each query path, wherein the The execution cost includes processor execution time, disk input and output time, and network transmission time, and the network transmission time is the time consumed by the transmission of data to be processed between memories; the query path with the smallest execution cost is determined to be the optimal query path;

执行模块,用于将所述最优查询路径分配给执行器调度给各个存储器执行。The execution module is configured to assign the optimal query path to executors and schedule each memory for execution.

结合第二方面,在第二方面的第一种可能的实现方式中,还包括:In combination with the second aspect, the first possible implementation manner of the second aspect further includes:

并行化规划模块,用于在查询规划模块根据所述查询请求消息的操作对象确定至少一个查询路径之前,根据当前各个存储器的运算能力,按照设定规则选择执行查询操作步骤的存储器。The parallelization planning module is used to select the memory for performing the query operation step according to the set rules according to the current computing capability of each memory before the query planning module determines at least one query path according to the operation object of the query request message.

本实施例的查询规划方法及装置,通过接收查询请求消息,根据查询请求消息的操作对象确定至少一个查询路径,每个查询路径包括至少一个查询操作步骤,针对各所述查询路径,确定每个查询路径的执行代价,其中执行代价包括处理器执行时间、磁盘输入输出时间以及网络传输时间,确定执行代价最小的查询路径为最优查询路径,根据当前各个存储器的运算能力,按照设定规则选择执行查询操作步骤的存储器,其中,选择的存储器数量小于饱和点且大于临界点,将最优查询路径分配给执行器调度给各个存储器执行,能够实现由按照最优查询路径规划时确定的存储器执行该最优查询路径的各个步骤获得的查询结果,可以保证通过该最优查询路径获得查询结果实际上付出的执行代价最小。In the query planning method and device of this embodiment, by receiving a query request message, at least one query path is determined according to the operation object of the query request message, each query path includes at least one query operation step, and each query path is determined for each query path The execution cost of the query path, where the execution cost includes processor execution time, disk input and output time, and network transmission time. The query path with the smallest execution cost is determined to be the optimal query path. According to the current computing power of each memory, select according to the set rules The memory that executes the query operation steps, wherein the number of memory selected is less than the saturation point and greater than the critical point, and the optimal query path is allocated to the executor to schedule each memory for execution, which can realize the memory execution determined according to the optimal query path planning The query results obtained by each step of the optimal query path can ensure that the execution cost actually paid for obtaining the query results through the optimal query path is the smallest.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description These are some embodiments of the present invention. For those skilled in the art, other drawings can also be obtained according to these drawings without any creative effort.

图1为本发明查询规划方法实施例一的流程图;FIG. 1 is a flowchart of Embodiment 1 of the query planning method of the present invention;

图2为本发明实施例所适用的无分享分布式数据库组网结构示意图;FIG. 2 is a schematic diagram of a shared-nothing distributed database networking structure applicable to an embodiment of the present invention;

图3为本发明查询规划装置实施例一的流程图。FIG. 3 is a flow chart of Embodiment 1 of the query planning device of the present invention.

具体实施方式Detailed ways

为使本发明的目的、技术方案和优点更加清楚,下面将结合本发明中的附图,对本发明中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, technical solutions and advantages of the present invention clearer, the technical solutions in the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the present invention. Obviously, the described embodiments are part of the embodiments of the present invention , but not all examples. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.

本实施例的查询规划方法可以采用查询规划装置来实现,该查询规划装置可以通过硬件或软件的方式实现,查询规划装置可以集成在计算机中实现查询规划方法。The query planning method in this embodiment can be implemented by using a query planning device, which can be implemented by means of hardware or software, and the query planning device can be integrated in a computer to implement the query planning method.

图1为本发明查询规划方法实施例一的流程图,本实施例的查询规划方法可以用于在无分享(Shared-nothing)分布式数据库组网中进行数据查询操作,图2为本发明实施例所适用的无分享分布式数据库组网结构示意图,如图2所示,无分享分布式数据库组网包括:主服务器、备服务器以及若干台存储器,其中,主服务器是整个无分享分布式数据库系统的控制及决策中心,对客户端主机提供服务,主服务器存储了各存储器中的数据分布信息等数据特征信息,由主服务器响应客户端主机的查询请求,备服务器是作为主服务器的备份存在。如图1所示,本实施例的查询规划方法包括:Figure 1 is a flowchart of Embodiment 1 of the query planning method of the present invention. The query planning method of this embodiment can be used to perform data query operations in a Shared-nothing distributed database network. Figure 2 is an implementation of the present invention. A schematic diagram of the shared-nothing distributed database network structure applicable to the example, as shown in Figure 2, the shared-nothing distributed database network includes: a primary server, a standby server, and several storage devices, where the primary server is the entire shared-nothing distributed database The control and decision-making center of the system provides services to the client host. The main server stores data characteristic information such as data distribution information in each memory, and the main server responds to the query request of the client host. The backup server exists as the backup of the main server. . As shown in Figure 1, the query planning method of this embodiment includes:

101、接收查询请求消息。101. Receive a query request message.

具体地,无分享分布式数据库中的主服务器接收来自任意一客户端主机发送的查询请求消息,该查询请求消息可以为结构化查询语言,该结构化查询语言请求服务器执行的查询操作在本实施例中例如可以为:请求服务器将一年级C1、C2和C3班的所有学生按照数学成绩由低到高排列名次,一年级C1、C2和C3班的所有学生的数学成绩可以分散地分布在无分享分布式数据库的多个存储器中。Specifically, the main server in the shared-nothing distributed database receives a query request message sent from any client host. The query request message can be a structured query language, and the query operation performed by the structured query language request server is in this implementation For example, it can be: request the server to rank all the students in classes C1, C2, and C3 in the first grade according to their math scores from low to high, and the math scores of all the students in classes C1, C2, and C3 in the first grade can be distributed in an infinite number of places. Share among multiple stores in a distributed database.

102、根据查询请求消息的操作对象确定至少一个查询路径,每个查询路径包括至少一个查询操作步骤。102. Determine at least one query path according to the operation object of the query request message, where each query path includes at least one query operation step.

具体地,主服务器的查询规划装置根据查询请求消息的操作对象即将一年级C1、C2和C3班的所有学生按照数学成绩由低到高排列名次确定至少一个查询路径,该至少一个查询路径为能够得到该查询请求的结果的查询路径,主服务器的查询规划装置可以根据动态规划算法或遗传算法生成至少一个查询路径,每个查询路径包括至少一个查询操作步骤,例如主服务器的查询规划装置根据动态规划算法生成的一查询路径A,查询路径A包括:操作1-扫描成绩列表,即根据主服务器对数据存储位置的记录,获知一年级C1、C2和C3班的所有学生的数学成绩数据在各存储器的存储位置;操作2-按照班级编号将数据重分布,即将C1班的所有学生的数学成绩数据从扫描到的各存储位置通过网络传输到目标存储器1,将C2班的所有学生的数学成绩数据从扫描到的各存储位置通过网络传输到目标存储器2,将C3班的所有学生的数学成绩数据从扫描到的各存储位置通过网络传输到目标存储器3,该目标存储器1、目标存储器2和目标存储器3可以是同一个存储器也可以是互不相同的存储器,还可以是其中两个存储器相同与另一存储器不同,主服务器的查询规划装置例如可以根据无分享分布式数据库组网中所有存储器的运算能力及繁忙程度确定执行该操作2的目标存储器1、目标存储器2和目标存储器3;操作3-将各个班级的学生按照数学成绩由低到高排列名次,即在上述操作2中确定的目标存储器1、目标存储器2和目标存储器3中分别对C1、C2和C3班的所有学生的数学成绩进行排序。主服务器的查询规划装置根据动态规划算法还可以生成另一查询路径B,查询路径B包括:操作1-扫描成绩列表;操作2-在本地存储器上将一年级C1、C2和C3班的学生按照数学成绩由低到高排列名次,即根据扫描到的存储位置,在该成绩所在的存储器中对成绩进行排序;操作3-按照班级编号将数据重分布,将本地存储器中的一年级C1、C2和C3班的学生的数学成绩通过网络分别传输到目标存储器1、目标存储器2和目标存储器3,该目标存储器1、目标存储器2和目标存储器3可以是同一个存储器也可以是互不相同的存储器,还可以是其中两个存储器相同与另一存储器不同;操作4-在目标存储器1、目标存储器2和目标存储器3上将各个班级的学生按照数学成绩由低到高排列名次。依据该查询路径A和查询路径B都能够得到查询请求结果,主服务器的查询规划装置根据动态规划算法还可以生成其它查询路径,此处不一一列举各个查询路径所包含的操作。Specifically, the query planning device of the main server determines at least one query path according to the operation object of the query request message, that is, all students in classes C1, C2, and C3 of the first grade are ranked from low to high according to their mathematics scores, and the at least one query path is able to To obtain the query path of the result of the query request, the query planning device of the main server can generate at least one query path according to a dynamic programming algorithm or a genetic algorithm, each query path includes at least one query operation step, for example, the query planning device of the main server according to the dynamic A query path A generated by the planning algorithm. The query path A includes: Operation 1-Scan the score list, that is, according to the records of the data storage location of the main server, the mathematics score data of all students in classes C1, C2 and C3 in the first grade are obtained in each The storage location of the memory; operation 2-redistribute the data according to the class number, that is, the mathematics achievement data of all the students in the C1 class are transferred from the scanned storage locations to the target memory 1 through the network, and the mathematics achievement data of all the students in the C2 class Data is transmitted to the target memory 2 through the network from each storage location scanned, and the mathematics performance data of all students in the C3 class is transmitted to the target memory 3 from each storage location scanned to, the target memory 1, the target memory 2 and The target storage 3 can be the same storage or different storages, or two of the storages are the same and different from the other storage. The query planning device of the master server can, for example, be based on all storages in the shared-nothing distributed database network. Determine the target memory 1, target memory 2, and target memory 3 for performing the operation 2; operation 3-arrange the students in each class according to the mathematics scores from low to high, which is determined in the above operation 2 The mathematics grades of all students in classes C1, C2 and C3 are sorted in target memory 1, target memory 2 and target memory 3 respectively. The query planning device of the main server can also generate another query path B according to the dynamic programming algorithm, and the query path B includes: operation 1-scanning score list; Math scores are ranked from low to high, that is, according to the scanned storage location, the scores are sorted in the storage where the scores are located; operation 3 - redistribute the data according to the class number, and the first grade C1 and C2 in the local storage The mathematics results of the students in class C3 and class C3 are respectively transmitted to target storage 1, target storage 2 and target storage 3 through the network. The target storage 1, target storage 2 and target storage 3 can be the same storage or different storages , It can also be that the two memories are the same and the other memory is different; Operation 4—on the target memory 1, the target memory 2 and the target memory 3, the students in each class are ranked from low to high according to their mathematics scores. According to the query path A and the query path B, the query request result can be obtained, and the query planning device of the main server can also generate other query paths according to the dynamic programming algorithm, and the operations included in each query path are not listed here.

103、针对各查询路径,确定每个查询路径的执行代价,其中执行代价包括处理器执行时间、磁盘输入输出时间以及网络传输时间,网络传输时间为待处理数据在存储器之间传输所消耗的时间。103. For each query path, determine the execution cost of each query path, where the execution cost includes processor execution time, disk input and output time, and network transmission time, and the network transmission time is the time consumed by the transmission of data to be processed between memories .

具体地,计算主服务器及存储器执行各个查询路径所需要的执行代价,即计算主服务器及存储器执行各个查询路径所包含的各个操作所需要的处理器执行时间、磁盘输入输出时间以及网络传输时间。Specifically, calculate the execution cost required by the main server and storage to execute each query path, that is, calculate the processor execution time, disk input and output time, and network transmission time required by the main server and storage to execute each operation included in each query path.

例如:分别计算查询路径A、查询路径B以及主服务器的查询规划装置根据动态规划算法生成的其它查询路径的执行代价,查询路径A的执行代价为:执行操作1所需要的处理器执行扫描成绩表的时间与执行操作2将学生的数学成绩从成绩所在的本地存储器通过网络传输到目标存储器所需要花费的网络传输时间以及执行操作3所需要的在目标存储器上对学生成绩进行排序所需要的处理器计算时间之和;查询路径B的执行代价为:执行操作1所需要的处理器执行扫描成绩表的时间与执行操作2所需要本地处存储器的处理器对学生成绩进行排序所需要的处理器计算时间与执行操作3所产生的将相同班级的学生的数学成绩从成绩所在的本地存储器通过网络传输到目标存储器所需要花费的网络传输时间以及目标存储器执行操作4所需要的处理器计算时间之和。For example: separately calculate the execution costs of query path A, query path B, and other query paths generated by the query planning device of the master server according to the dynamic programming algorithm, the execution cost of query path A is: the processor execution scan score required to perform operation 1 The time of the table and the network transmission time required to perform operation 2 to transfer the student's math grades from the local storage where the grades are located to the target storage through the network and the time required to perform operation 3 to sort the students' grades on the target storage The sum of the calculation time of the processor; the execution cost of the query path B is: the time required for the processor to scan the grade table for operation 1 and the processing required for the processor in the local memory required for operation 2 to sort the grades of the students Computing time of the processor and the network transmission time required to transfer the mathematics grades of the students in the same class from the local storage where the grades are located to the target storage through the network and the computing time of the processor required for the target storage to perform operation 4 generated by performing operation 3 Sum.

104、确定执行代价最小的查询路径为最优查询路径。104. Determine the query path with the smallest execution cost as the optimal query path.

具体地,比较上述103中确定的每个查询路径的执行代价值,将执行代价值最小的查询路径作为最优查询路径,例如查询路径A的执行代价值最小,则查询路径A为最优查询路径。Specifically, compare the execution cost of each query path determined in 103 above, and use the query path with the smallest execution cost as the optimal query path, for example, query path A has the smallest execution cost, then query path A is the optimal query path.

105、将最优查询路径分配给执行器调度给各个存储器执行。105. Allocate the optimal query path to an executor and schedule each memory for execution.

具体地,主服务器的查询规划装置将最优查询路径分配给主服务器的执行器,执行器根据查询路径调度参与该最优查询路径的各个操作的存储器,得到操作结果,例如:确定的参与执行最优查询路径A的操作2的目标存储器为存储器1和存储器2,将C1和C2班的所有学生的数学成绩传输到存储器1,将C3班的所有学生的数学成绩传输到存储器2,则主服务器的执行器调度存储器1和存储器2执行操作2。再执行操作3,进行成绩排序。Specifically, the query planning device of the main server assigns the optimal query path to the executor of the main server, and the executor schedules the memory that participates in each operation of the optimal query path according to the query path, and obtains the operation result, for example: the determined participating execution The target memory of operation 2 of the optimal query path A is memory 1 and memory 2, transfer the mathematics scores of all students in classes C1 and C2 to memory 1, and transfer the mathematics scores of all students in class C3 to memory 2, then the main The server's executor schedules storage1 and storage2 to execute operation2. Then perform operation 3 to sort the grades.

存储器1和存储器2将执行结果反馈给主服务器。Storage 1 and storage 2 feed back the execution results to the main server.

本实施例的查询规划方法,通过增加考虑了网络传输代价,即考虑了数据各个操作中出现的在不同存储器之间的传输代价,能够适用于分布式存储架构,保证通过该最优查询路径获得查询结果实际上付出的执行代价最小。The query planning method of this embodiment can be applied to the distributed storage architecture by taking into account the network transmission cost, that is, the transmission cost between different memories in each operation of the data, and ensure that the optimal query path is obtained through the optimal query path. The query result actually pays the least execution cost.

在上述实施例的基础上,进一步地,在根据查询请求消息的操作对象确定至少一个查询路径之前主服务器的查询规划装置还可以根据当前各个存储器的运算能力,按照设定规则选择执行查询操作步骤的存储器。On the basis of the above embodiments, further, before determining at least one query path according to the operation object of the query request message, the query planning device of the main server can also select and execute the query operation steps according to the set rules according to the current computing capabilities of each memory. of memory.

具体地,选择执行查询操作步骤的存储器时,例如:在根据查询请求消息的操作对象确定至少一个查询路径之前选择执行查询路径A的操作2的存储器时,主服务器的查询规划装置可以根据当前各存储器的工作繁忙程度,以及剩余内存空间大小等因素选择适当数量的存储器执行查询路径A的操作2,该存储器的适当数量可以小于饱和点且大于临界点,存储器数量的饱和点和临界点可以根据存储器的当前繁忙状态动态确定。例如,如果3个存储器参与执行操作2所需要付出的代价小于4个存储器参与执行操作2所需要的代价,那么可以认为4是执行操作2的存储器数量的饱和点,如果2个存储器参与执行操作2所需要付出的代价大于3个存储器参与执行操作2所需要的代价,那么可以认为2是执行操作2的存储器数量的临界点。Specifically, when selecting a memory for performing query operation steps, for example: when selecting a memory for performing operation 2 of query path A before determining at least one query path according to the operation object of the query request message, the query planning device of the master server may according to the current Select an appropriate amount of memory to perform operation 2 of query path A based on factors such as the busyness of the memory and the size of the remaining memory space. The appropriate amount of the memory can be less than the saturation point and greater than the critical point. The saturation point and critical point of the amount of memory can be determined according to The current busy state of the memory is determined dynamically. For example, if the cost of 3 memories involved in performing operation 2 is less than the cost of 4 memories involved in performing operation 2, then 4 can be considered as the saturation point for the number of memories performing operation 2, and if 2 memories participate in performing operations The cost required to pay for 2 is greater than the cost required for 3 memories to participate in the execution of operation 2, then 2 can be considered to be the critical point of the number of memories that perform operation 2.

本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于一计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。Those of ordinary skill in the art can understand that all or part of the steps for realizing the above-mentioned method embodiments can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the It includes the steps of the above method embodiments; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk and other various media that can store program codes.

图3为本发明查询规划装置实施例一的流程图,如图3所示,本实施例的查询规划装置300包括:接收模块301、查询规划模块302和执行模块303,其中,接收模块301可以用于接收查询请求消息;查询规划模块302可以用于根据所述查询请求消息的操作对象确定至少一个查询路径,每个查询路径包括至少一个查询操作步骤;针对各所述查询路径,确定每个查询路径的执行代价,其中所述执行代价包括处理器执行时间、磁盘输入输出时间以及网络传输时间,所述网络传输时间为待处理数据在存储器之间传输所消耗的时间;确定执行代价最小的查询路径为最优查询路径;执行模块303可以用于将所述最优查询路径分配给执行器调度给各个存储器执行。FIG. 3 is a flowchart of Embodiment 1 of the query planning device of the present invention. As shown in FIG. For receiving a query request message; the query planning module 302 can be used to determine at least one query path according to the operation object of the query request message, each query path includes at least one query operation step; for each of the query paths, determine each The execution cost of the query path, wherein the execution cost includes processor execution time, disk input and output time, and network transmission time, and the network transmission time is the time consumed by the transmission of data to be processed between memories; determine the minimum execution cost The query path is an optimal query path; the execution module 303 can be configured to assign the optimal query path to executors and schedule each memory for execution.

本实施例的查询规划装置300可以用于执行查询规划方法实施例一的查询规划方法,具体执行方法可以参考查询规划方法实施例一,此处不再赘述。The query planning apparatus 300 in this embodiment can be used to execute the query planning method in the first embodiment of the query planning method. For a specific execution method, refer to the first embodiment of the query planning method, which will not be repeated here.

本实施例的查询规划装置,通过接收模块接收查询请求消息,查询规划模块根据查询请求消息的操作对象确定至少一个查询路径,每个查询路径包括至少一个查询操作步骤,针对各所述查询路径,确定每个查询路径的执行代价,其中执行代价包括处理器执行时间、磁盘输入输出时间以及网络传输时间,确定执行代价最小的查询路径为最优查询路径,执行模块将最优查询路径分配给执行器调度给各个存储器执行,能够实现按照查询规划模块确定的最优查询路径获得查询结果实际上付出的执行代价最小。The query planning device of this embodiment receives the query request message through the receiving module, the query planning module determines at least one query path according to the operation object of the query request message, each query path includes at least one query operation step, and for each query path, Determine the execution cost of each query path, where the execution cost includes processor execution time, disk input and output time, and network transmission time, determine the query path with the smallest execution cost as the optimal query path, and the execution module assigns the optimal query path to the execution The processor is scheduled to be executed by each memory, which can achieve the minimum execution cost to obtain the query results according to the optimal query path determined by the query planning module.

进一步地,在上述实施例的基础上,查询规划装置300还可以包括:并行化规划模块,其中,并行化规划模块可以用于在查询规划模块根据所述查询请求消息的操作对象确定至少一个查询路径之前,根据当前各个存储器的运算能力,按照设定规则选择执行查询操作步骤的存储器。Further, on the basis of the above-mentioned embodiments, the query planning device 300 may further include: a parallel planning module, wherein the parallel planning module may be used to determine at least one query in the query planning module according to the operation object of the query request message Before the path, according to the current computing power of each memory, the memory for performing the query operation step is selected according to the set rules.

最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present invention, rather than limiting them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: It is still possible to modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the technical solutions of the various embodiments of the present invention. scope.

Claims (4)

1. a query planning method is characterized in that, comprising:
Receive inquiry request message;
Determine at least one query path according to the operand of described inquiry request message, each query path comprises at least one query manipulation step;
For each described query path, determine the Executing Cost of each query path, wherein said Executing Cost comprises processor execution time, disk input and output time and network latency, and described network latency is that pending data are transmitted the time that consumes between storer;
The query path of determining the Executing Cost minimum is optimum query path;
Actuator is distributed in described optimum query path to be dispatched to each storer execution.
2. query planning method according to claim 1 is characterized in that, before determining at least one query path according to the operand of described inquiry request message, also comprises:
According to the arithmetic capability of current each storer, according to the storer of setting rules selection execution query manipulation step.
3. a query planning device is characterized in that, comprising:
Receiver module is used for receiving inquiry request message;
The query planning module is used for determining at least one query path according to the operand of described inquiry request message that each query path comprises at least one query manipulation step; For each described query path, determine the Executing Cost of each query path, wherein said Executing Cost comprises processor execution time, disk input and output time and network latency, and described network latency is that pending data are transmitted the time that consumes between storer; The query path of determining the Executing Cost minimum is optimum query path;
Execution module is used for that actuator is distributed in described optimum query path and dispatches to each storer execution.
4. device according to claim 3 is characterized in that, also comprises:
The parallelization planning module was used for before the query planning module is determined at least one query path according to the operand of described inquiry request message, according to the arithmetic capability of current each storer, according to the storer of setting rules selection execution query manipulation step.
CN2012105863060A 2012-12-28 2012-12-28 Inquiry planning method and device Pending CN103064955A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2012105863060A CN103064955A (en) 2012-12-28 2012-12-28 Inquiry planning method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2012105863060A CN103064955A (en) 2012-12-28 2012-12-28 Inquiry planning method and device

Publications (1)

Publication Number Publication Date
CN103064955A true CN103064955A (en) 2013-04-24

Family

ID=48107585

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2012105863060A Pending CN103064955A (en) 2012-12-28 2012-12-28 Inquiry planning method and device

Country Status (1)

Country Link
CN (1) CN103064955A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106407432A (en) * 2016-09-28 2017-02-15 郑州云海信息技术有限公司 Oracle data warehouse query method and device
CN108108473A (en) * 2018-01-02 2018-06-01 联想(北京)有限公司 Data query method and server
CN108491274A (en) * 2018-04-02 2018-09-04 深圳市华傲数据技术有限公司 Optimization method, device, storage medium and the equipment of distributed data management
CN108664516A (en) * 2017-03-31 2018-10-16 华为技术有限公司 Enquiring and optimizing method and relevant apparatus
CN108874954A (en) * 2018-06-04 2018-11-23 深圳市华傲数据技术有限公司 A kind of optimization method of data base querying, medium and equipment
CN109241093A (en) * 2017-06-30 2019-01-18 华为技术有限公司 A kind of method of data query, relevant apparatus and Database Systems
CN110955726A (en) * 2019-11-26 2020-04-03 中思博安科技(北京)有限公司 Method and device for determining distributed cost, storage medium and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101408900A (en) * 2008-11-24 2009-04-15 中国科学院地理科学与资源研究所 Distributed space data enquiring and optimizing method under gridding calculation environment
CN101739451A (en) * 2009-12-03 2010-06-16 南京航空航天大学 Joint query adaptive processing method for grid database
CN101739398A (en) * 2008-11-11 2010-06-16 山东省标准化研究院 Distributed database multi-join query optimization algorithm
CN102541640A (en) * 2011-12-28 2012-07-04 厦门市美亚柏科信息股份有限公司 Cluster GPU (graphic processing unit) resource scheduling system and method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101739398A (en) * 2008-11-11 2010-06-16 山东省标准化研究院 Distributed database multi-join query optimization algorithm
CN101408900A (en) * 2008-11-24 2009-04-15 中国科学院地理科学与资源研究所 Distributed space data enquiring and optimizing method under gridding calculation environment
CN101739451A (en) * 2009-12-03 2010-06-16 南京航空航天大学 Joint query adaptive processing method for grid database
CN102541640A (en) * 2011-12-28 2012-07-04 厦门市美亚柏科信息股份有限公司 Cluster GPU (graphic processing unit) resource scheduling system and method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
金正淑等: "查询优化在分布式数据库系统中的应用", 《计算机应用与软件》, no. 11, 30 November 2003 (2003-11-30) *

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106407432A (en) * 2016-09-28 2017-02-15 郑州云海信息技术有限公司 Oracle data warehouse query method and device
CN106407432B (en) * 2016-09-28 2020-02-07 苏州浪潮智能科技有限公司 Query method and device for Oracle data warehouse
CN108664516A (en) * 2017-03-31 2018-10-16 华为技术有限公司 Enquiring and optimizing method and relevant apparatus
CN109241093A (en) * 2017-06-30 2019-01-18 华为技术有限公司 A kind of method of data query, relevant apparatus and Database Systems
CN109241093B (en) * 2017-06-30 2021-06-08 华为技术有限公司 A data query method, related device and database system
CN108108473A (en) * 2018-01-02 2018-06-01 联想(北京)有限公司 Data query method and server
CN108491274A (en) * 2018-04-02 2018-09-04 深圳市华傲数据技术有限公司 Optimization method, device, storage medium and the equipment of distributed data management
CN108874954A (en) * 2018-06-04 2018-11-23 深圳市华傲数据技术有限公司 A kind of optimization method of data base querying, medium and equipment
CN110955726A (en) * 2019-11-26 2020-04-03 中思博安科技(北京)有限公司 Method and device for determining distributed cost, storage medium and electronic equipment
CN110955726B (en) * 2019-11-26 2022-12-23 中思博安科技(北京)有限公司 Method and device for determining distributed cost, storage medium and electronic equipment

Similar Documents

Publication Publication Date Title
CN113692609B (en) Multi-agent reinforcement learning with order dispatch by order vehicle distribution matching
Gill et al. BULLET: particle swarm optimization based scheduling technique for provisioned cloud resources
Kaur et al. Deep‐Q learning‐based heterogeneous earliest finish time scheduling algorithm for scientific workflows in cloud
CN103064955A (en) Inquiry planning method and device
US9092266B2 (en) Scalable scheduling for distributed data processing
Zhang et al. An effective data locality aware task scheduling method for MapReduce framework in heterogeneous environments
CN110737529A (en) cluster scheduling adaptive configuration method for short-time multiple variable-size data jobs
US8589929B2 (en) System to provide regular and green computing services
CN108351805A (en) Calculate the accelerator processing based on stream of figure
US20150286504A1 (en) Scheduling and execution of tasks
KR101770191B1 (en) Resource allocation and apparatus
CN111124644B (en) Method, device and system for determining task scheduling resources
CN110673959A (en) System, method and apparatus for processing tasks
CN105897864A (en) Scheduling method for cloud workflow
WO2024164712A1 (en) Cloud flow task scheduling method and apparatus, and electronic device and storage medium
Castillo et al. Online algorithms for advance resource reservations
US10635492B2 (en) Leveraging shared work to enhance job performance across analytics platforms
Han et al. Inss: An intelligent scheduling orchestrator for multi-gpu inference with spatio-temporal sharing
WO2016084327A1 (en) Resource prediction device, resource prediction method, resource prediction program and distributed processing system
US11107037B2 (en) Method and system of sharing product data in a collaborative environment
US8370422B2 (en) Establishing common interest negotiation links between consumers and suppliers to facilitate solving a resource allocation problem
CN116777186B (en) Operation and maintenance work order allocation methods, devices, computer equipment and storage media
Goldsztajn et al. Utility maximizing load balancing policies
Al-Masri et al. Enhancing resource provisioning across edge-based environments
Zohora et al. DBDAA: A real-time approach to Dynamic Banker’s Deadlock Avoidance Algorithm with optimized time complexity

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20130424

RJ01 Rejection of invention patent application after publication
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载