CN115328939A - Method for processing query statement by database, storage medium and computer equipment - Google Patents
Method for processing query statement by database, storage medium and computer equipment Download PDFInfo
- Publication number
- CN115328939A CN115328939A CN202210944105.7A CN202210944105A CN115328939A CN 115328939 A CN115328939 A CN 115328939A CN 202210944105 A CN202210944105 A CN 202210944105A CN 115328939 A CN115328939 A CN 115328939A
- Authority
- CN
- China
- Prior art keywords
- query
- database
- query statement
- statement
- processing
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/242—Query formulation
- G06F16/2433—Query languages
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Mathematical Physics (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
技术领域technical field
本发明涉及数据库技术,特别是涉及一种数据库处理查询语句的方法、存储介质与计算机设备。The invention relates to database technology, in particular to a database processing query statement method, storage medium and computer equipment.
背景技术Background technique
对一个给定的查询语句,通常存在多种可能的策略,查询优化就是从中找出最有效的的查询执行计划的处理过程。针对同一个查询语句,不同的执行计划的代价上可能存在非常大的区别。数据库系统的优化器的任务就是生成优选的查询执行。For a given query statement, there are usually many possible strategies, and query optimization is the process of finding the most effective query execution plan. For the same query statement, the cost of different execution plans may be very different. The task of the optimizer of the database system is to generate optimal query execution.
现有技术中的数据库系统,优化器在处理含有统计非重复结果的查询操作(count(distinct)操作)时,一般对数据表先做顺序扫描,然后对扫描得到的结果使用聚集操作进行去重。In the database system in the prior art, when the optimizer processes the query operation (count (distinct) operation) containing statistical non-duplicate results, it generally scans the data table sequentially, and then uses the aggregation operation to deduplicate the scanned results .
然而,上述count(distinct)操作,由于存在distinct关键字,优化器不能并行操作,因而无法有效利用多核CPU带来的性能提升。此外,优化器采用Aggregate来达到去重和聚集操作,无法根据代价来选择合适的HashAggregate或者GroupAggregate。However, the above-mentioned count (distinct) operation, due to the existence of the distinct keyword, the optimizer cannot operate in parallel, so the performance improvement brought by the multi-core CPU cannot be effectively utilized. In addition, the optimizer uses Aggregate to achieve deduplication and aggregation operations, and cannot choose the appropriate HashAggregate or GroupAggregate based on the cost.
基于以上两种原因,现有数据库的count(distinct)操作的处理性能较低,影响了数据库查询性能的提升。Based on the above two reasons, the processing performance of the count (distinct) operation of the existing database is low, which affects the improvement of the database query performance.
发明内容Contents of the invention
本发明的一个目的是要至少解决上述任一方面技术问题的数据库处理查询语句的方法、存储介质与计算机设备。One object of the present invention is a database processing query statement method, storage medium and computer equipment that at least solve any of the above-mentioned technical problems.
本发明一个进一步的目的是提高针对数据库count(distinct)操作的处理性能。A further object of the present invention is to improve the processing performance for the database count(distinct) operation.
特别地,本发明提供了一种数据库处理查询语句的方法,其包括:In particular, the present invention provides a method for database processing query statements, which includes:
获取数据库的查询语句;Obtain the query statement of the database;
判断查询语句是否包含统计非重复结果的查询操作;Determine whether the query statement contains a query operation that counts non-repeated results;
若是,判断查询操作针对的数据列是否满足预设的优化条件;If yes, determine whether the data column targeted by the query operation satisfies the preset optimization condition;
若是,对查询操作进行等价逻辑变换,得到等价操作;If so, perform an equivalent logical transformation on the query operation to obtain an equivalent operation;
由数据库的优化器优化等价操作,以生成执行计划。Equivalent operations are optimized by the database's optimizer to generate an execution plan.
可选地,获取数据库的查询语句的步骤包括:Optionally, the steps of obtaining the query statement of the database include:
接受对数据库的操作语句;Accept the operation statement on the database;
判断操作语句是否包含选择查询;Determine whether the operation statement contains a selection query;
若是,则提取包含选择查询的语句,作为查询语句。If so, extract the statement including the selection query as the query statement.
可选地,判断查询语句是否包含统计非重复结果的查询操作的步骤包括:Optionally, the step of judging whether the query statement includes a query operation for counting non-repeated results includes:
对查询语句进行语义分析,以得到分析结果,分析结果包含以下任意一项或多项:查询语句的视图、查询语句的函数、查询语句的父查询或者查询语句中嵌套的子查询;Perform semantic analysis on the query statement to obtain the analysis result. The analysis result includes any one or more of the following: the view of the query statement, the function of the query statement, the parent query of the query statement or the subquery nested in the query statement;
判断分析结果是否同时包含计数函数以及非重复查询操作的关键字;Determine whether the analysis results contain both counting functions and keywords of non-repeated query operations;
若是,则确定查询语句包含统计非重复结果的查询操作。If yes, it is determined that the query statement includes a query operation for counting non-repeated results.
所述非重复查询操作的关键词为distinct,所述分组聚集子查询函数为groupby。The keyword of the non-repetitive query operation is distinct, and the grouping aggregation subquery function is groupby.
可选地,对查询操作进行等价逻辑变换的步骤包括:Optionally, the step of performing an equivalent logical transformation on the query operation includes:
新建子查询或者视图替换查询操作的数据表;Create a new subquery or view to replace the data table of the query operation;
设置子查询或者视图的聚集函数参数为否;Set the aggregate function parameter of the subquery or view to No;
将数据列投影至子查询或者视图,作为投影列;Project data columns to subqueries or views as projection columns;
将非重复查询操作转换为分组聚集子查询;Convert distinct query operations into group-by-aggregate subqueries;
更新分组聚集子查询中的列位置信息。Update the column position information in the group-by-aggregate subquery.
可选地,判断查询操作针对的数据列是否满足预设的优化条件的步骤包括:Optionally, the step of judging whether the data column targeted by the query operation satisfies a preset optimization condition includes:
查询数据列的数据重复度是否在预设的阈值范围内;Query whether the data repetition degree of the data column is within the preset threshold range;
若是,则确定数据列满足优化条件。If yes, it is determined that the data column satisfies the optimization condition.
可选地,阈值范围设置为60%到100%。Optionally, the threshold range is set from 60% to 100%.
可选地,在查询语句不包含统计非重复结果的查询操作或者查询操作针对的数据列不满足优化条件的情况下,由数据库的优化器直接对查询语句进行优化。Optionally, when the query statement does not include a query operation for counting non-repeated results or the data column targeted by the query operation does not meet the optimization condition, the optimizer of the database directly optimizes the query statement.
根据本发明的另一个方面,还提供了一种机器可读存储介质,其上存储有机器可执行程序,机器可执行程序被处理器执行时实现上述任一种的数据库处理查询语句的方法。According to another aspect of the present invention, there is also provided a machine-readable storage medium, on which a machine-executable program is stored. When the machine-executable program is executed by a processor, any one of the above methods for processing query statements in a database is implemented.
根据本发明的又一个方面,还提供了一种计算机设备,包括存储器、处理器及存储在存储器上并在处理器上运行的机器可执行程序,并且处理器执行机器可执行程序时实现上述任一种的数据库处理查询语句的方法。According to yet another aspect of the present invention, there is also provided a computer device, including a memory, a processor, and a machine-executable program stored on the memory and running on the processor, and when the processor executes the machine-executable program, any of the above-mentioned A database method for processing query statements.
本发明的数据库处理查询语句的方法,对于包含统计非重复结果的查询操作的查询语句,判断其是否能够满足预设的优化条件,并在满足优化条件的情况下;对查询操作进行等价逻辑变换,得到等价操作;由数据库的优化器进一步优化等价操作。通过增加逻辑优化规则,在符合优化条件的情况下,将查询操作变换为等价操作,从而提高了查询性能。In the method for database processing query statement of the present invention, for the query statement containing the query operation of statistical non-repetitive results, it is judged whether it can meet the preset optimization condition, and in the case of satisfying the optimization condition; perform equivalent logic on the query operation The equivalent operation is obtained by transformation; the equivalent operation is further optimized by the optimizer of the database. By adding logic optimization rules, query operations are transformed into equivalent operations when the optimization conditions are met, thereby improving query performance.
进一步地,本发明的数据库处理查询语句的方法,将count(distinct)转换成分组聚集操作(group by去重),从而避免了由于distinct关键字,优化器不能并行操作的问题,实现了通过并行、HashAggregate/GroupAggregate以及索引等有效手段来提升查询性能。Further, the database processing query statement method of the present invention converts count (distinct) into a grouping aggregation operation (group by deduplication), thereby avoiding the problem that the optimizer cannot operate in parallel due to the distinct keyword, and realizes the parallel operation through parallel operation. , HashAggregate/GroupAggregate and indexes to improve query performance.
更进一步地,本发明的数据库处理查询语句的方法,经过实际验证,在满足优化条件的场景下,数据库的处理性能得到了极大的提升。Furthermore, the method for processing query statements in the database of the present invention has been verified in practice, and the processing performance of the database has been greatly improved in the scenario where the optimization conditions are met.
根据下文结合附图对本发明具体实施例的详细描述,本领域技术人员将会更加明了本发明的上述以及其他目的、优点和特征。Those skilled in the art will be more aware of the above and other objects, advantages and features of the present invention according to the following detailed description of specific embodiments of the present invention in conjunction with the accompanying drawings.
附图说明Description of drawings
后文将参照附图以示例性而非限制性的方式详细描述本发明的一些具体实施例。附图中相同的附图标记标示了相同或类似的部件或部分。本领域技术人员应该理解,这些附图未必是按比例绘制的。附图中:Hereinafter, some specific embodiments of the present invention will be described in detail by way of illustration and not limitation with reference to the accompanying drawings. The same reference numerals in the drawings designate the same or similar parts or parts. Those skilled in the art will appreciate that the drawings are not necessarily drawn to scale. In the attached picture:
图1是根据本发明一个实施例的数据库处理查询语句的方法的示意图;1 is a schematic diagram of a method for processing a query statement in a database according to an embodiment of the present invention;
图2是根据本发明一个实施例的数据库处理查询语句的方法中判断优化条件的流程图;Fig. 2 is a flow chart of judging optimization conditions in the method for database processing query statement according to an embodiment of the present invention;
图3是根据本发明一个实施例的数据库处理查询语句的方法中等价逻辑变换的代数形式的示意图;Fig. 3 is a schematic diagram of an algebraic form of an equivalent logical transformation in a method for processing a query statement in a database according to an embodiment of the present invention;
图4是根据本发明一个实施例的数据库处理查询语句的方法中等价逻辑变换的流程图;Fig. 4 is the flow chart of equivalent logical conversion in the method for database processing query statement according to one embodiment of the present invention;
图5是根据本发明一个实施例的机器可读存储介质的示意图;以及Figure 5 is a schematic diagram of a machine-readable storage medium according to one embodiment of the present invention; and
图6是根据本发明一个实施例的计算机设备的示意图。Figure 6 is a schematic diagram of a computer device according to one embodiment of the present invention.
具体实施方式Detailed ways
图1是根据本发明一个实施例的数据库处理查询语句的方法的示意图,该数据库处理查询语句的方法一般性地可以包括:FIG. 1 is a schematic diagram of a method for processing a query statement by a database according to an embodiment of the present invention. The method for processing a query statement by the database may generally include:
步骤S102,获取数据库的查询语句,在使用SQL(Structured Query Language,结构化查询语言)的情况下,可以通过检查SQL语句中select的关键词来确定查询语句。In step S102, the query statement of the database is obtained. In the case of using SQL (Structured Query Language, Structured Query Language), the query statement can be determined by checking the keyword of select in the SQL statement.
例如步骤S102可以具体包括:接受对数据库的操作语句;判断操作语句是否包含选择查询select;若是,则提取包含选择查询的语句,作为查询语句。例如对于SQL操作语句可以通过检查select查询来确定选择查询。For example, step S102 may specifically include: accepting an operation statement to the database; judging whether the operation statement contains a select query; if so, extracting the statement containing the select query as a query statement. For example, the SQL operation statement can determine the select query by checking the select query.
步骤S104,判断查询语句是否包含统计非重复结果的查询操作。也即判断查询语句是否包含count(distinct)。Step S104, judging whether the query sentence includes query operations for counting non-repeated results. That is, it is judged whether the query statement contains count(distinct).
步骤S104可以首先对对查询语句进行语义分析,以得到分析结果。分析结果包含以下任意一项或多项:查询语句的视图、查询语句的函数、查询语句的父查询或者查询语句中嵌套的子查询。得到分析结果后,判断分析结果是否同时包含计数函数以及非重复查询操作的关键字;若是,则确定查询语句包含统计非重复结果的查询操作。也就是说可以通过检查上述视图、函数、父查询或者嵌套的子查询是否有聚集函数且聚集函数为count函数来确定计数函数;同时通过检查是否有distinct聚集操作(aggdistinct操作)来确定非重复查询。Step S104 may first perform semantic analysis on the query statement to obtain an analysis result. The analysis result includes any one or more of the following: the view of the query statement, the function of the query statement, the parent query of the query statement, or the subquery nested in the query statement. After the analysis result is obtained, it is determined whether the analysis result contains both the counting function and the keyword of the non-repeated query operation; if so, it is determined that the query statement contains the query operation of counting the non-repeated results. That is to say, the counting function can be determined by checking whether the above view, function, parent query or nested subquery has an aggregate function and the aggregate function is a count function; at the same time, it can be determined by checking whether there is a distinct aggregation operation (aggdistinct operation) to determine the uniqueness Inquire.
步骤S106,若是,判断查询操作针对的数据列是否满足预设的优化条件。优化条件可以通过将数据列的数据重复度来判断。也即步骤S106的判断可以具体为:查询数据列的数据重复度是否在预设的阈值范围内;若是,则确定数据列满足优化条件。阈值范围设置为60%到100%,也即在数据60%至100%重复的情况下,认为实现本实施例的方法中新增的优化规则可以等到更好的优化结果。通过对本实施例方法的实际验证,也证明了这一点。Step S106, if yes, determine whether the data column targeted by the query operation satisfies a preset optimization condition. The optimization condition can be judged by the data repetition degree of the data column. That is to say, the judgment in step S106 may specifically be: whether the data repetition degree of the query data column is within a preset threshold range; if yes, determine that the data column satisfies the optimization condition. The threshold range is set from 60% to 100%, that is, in the case of 60% to 100% repetition of data, it is considered that the implementation of the newly added optimization rules in the method of this embodiment can wait for a better optimization result. This point is also proved by the actual verification of the method of this embodiment.
步骤S108,若是,对查询操作进行等价逻辑变换,得到等价操作。等价操作用于将count(distinct)中的distinct消除,从而解决不能并行操作的问题。Step S108, if yes, perform an equivalent logical transformation on the query operation to obtain an equivalent operation. The equivalent operation is used to eliminate the distinct in count(distinct), so as to solve the problem that cannot be operated in parallel.
步骤S110,由数据库的优化器优化等价操作,以生成执行计划。In step S110, the optimizer of the database optimizes equivalent operations to generate an execution plan.
步骤S112,如果上述步骤S106以及步骤S108的判断结果任一为否,也即在查询语句不包含统计非重复结果的查询操作或者查询操作针对的数据列不满足优化条件的情况下,由数据库的优化器直接对查询语句进行优化。Step S112, if any of the judgment results of the above-mentioned step S106 and step S108 is negative, that is, if the query statement does not contain a query operation that counts non-repeated results or the data column targeted by the query operation does not meet the optimization conditions, the database The optimizer directly optimizes the query statement.
上述实施例的数据库处理查询语句的方法也可以理解为在满足4个条件下,进行对查询操作进行等价逻辑变换。对于SQL语句,4个条件包括:The method for processing a query statement by a database in the above embodiment can also be understood as performing an equivalent logical transformation on the query operation when four conditions are met. For SQL statements, the 4 conditions include:
(1)SQL语句是select查询;(1) The SQL statement is a select query;
(2)查询语句的视图、函数、父查询或者嵌套的子查询中,有聚集函数且是count函数;(2) In the view, function, parent query or nested subquery of the query statement, there is an aggregate function and it is a count function;
(3)存在aggdistinct操作;(3) There is an aggdistinct operation;
(4)查询聚集列的数据重复度在预设的阈值范围内,阈值范围可以由数据库的用户设置,例如设置为60%到100%。(4) The data repetition degree of the query aggregation column is within a preset threshold range, which can be set by the database user, for example, 60% to 100%.
图2是根据本发明一个实施例的数据库处理查询语句的方法中判断优化条件的流程图。该流程图可以包括:FIG. 2 is a flow chart of judging optimization conditions in a method for processing query statements in a database according to an embodiment of the present invention. The flowchart can include:
步骤S202,判断SQL语句是否为select查询;Step S202, judging whether the SQL statement is a select query;
步骤S204,判断查询语句的视图、函数、父查询或者嵌套的子查询中是否存在聚集函数且是count函数;Step S204, judging whether there is an aggregate function and it is a count function in the view, function, parent query or nested subquery of the query statement;
步骤S206,判断是否存在aggdistinct操作;Step S206, judging whether there is an aggdistinct operation;
步骤S208,判断查询聚集列的数据重复度是否在预设的阈值范围内;Step S208, judging whether the data repetition degree of the query aggregation column is within a preset threshold range;
步骤S210,执行count(distinct)等价逻辑转换;Step S210, performing count (distinct) equivalent logic conversion;
步骤S212,优化器继续优化工作。In step S212, the optimizer continues the optimization work.
如果满足上述4个条件,则认为符合count(distinct)等价逻辑变换规则,优化器消除distinct关键字,使用子查询或者视图通过group by进行去重操作。为了保证等价变换带来性能收益可以进一步确定查询列的重复度在60%到100%范围内,进行等价逻辑变换。也即增加列数据重复度的阈值范围设置,只有查询列的重复度达到设置的阈值范围时才会进行等价逻辑变换。If the above four conditions are met, it is considered to meet the count (distinct) equivalent logical transformation rule, the optimizer eliminates the distinct keyword, and uses subqueries or views to perform deduplication operations through group by. In order to ensure that the equivalent transformation brings performance benefits, it can be further determined that the repetition degree of the query column is in the range of 60% to 100%, and an equivalent logical transformation is performed. That is to say, increase the threshold range setting of column data duplication, and only when the duplication of the query column reaches the set threshold range, the equivalent logical transformation will be performed.
例如对于查询:select count(distinct name)from t1,进行等价逻辑变换后的等价SQL语句为:select count(name)from(select name from t1 group by name)ν。count(distinct)转换成分组聚集操作(group by去重),避免了由于distinct关键字,优化器不能并行操作的问题。For example, for the query: select count(distinct name) from t1, the equivalent SQL statement after equivalent logical transformation is: select count(name) from(select name from t1 group by name)ν. count(distinct) is converted into a group aggregation operation (group by deduplication), which avoids the problem that the optimizer cannot operate in parallel due to the distinct keyword.
图3是根据本发明一个实施例的数据库处理查询语句的方法中等价逻辑变换的代数形式的示意图。仍以select count(distinct name)from t1为例,在转换前的代数形式30中,表t1首选执行选择ρ(name),然后执行聚集Gcount_distinct(name)。在转换后的代数形式31中,select count(name)from(select name from t1 group by name)ν的代数形式为:表t1首选执行选择ρν(name),然后执行投影Пname,Group bynameG,最终执行聚集Gcount(name)。Fig. 3 is a schematic diagram of an algebraic form of an equivalent logical transformation in a method for processing a query statement in a database according to an embodiment of the present invention. Still taking select count(distinct name) from t1 as an example, in the
图4是根据本发明一个实施例的数据库处理查询语句的方法中等价逻辑变换的流程图。等价逻辑变换包括以下步骤:Fig. 4 is a flow chart of equivalent logic transformation in the method for processing query statements in a database according to an embodiment of the present invention. Equivalent logical transformation includes the following steps:
步骤S402,新建子查询或者视图替换查询操作的数据表;也即通过新建的子查询或者视图来替代t1。Step S402, create a new subquery or view to replace the data table of the query operation; that is, replace t1 with the new subquery or view.
步骤S404,设置子查询或者视图的聚集函数参数为否;也即设置子查询或者视图的聚集函数参数hasAggs=false。Step S404, setting the aggregate function parameter of the subquery or view to No; that is, setting hasAggs=false as the aggregate function parameter of the subquery or view.
步骤S406,将数据列投影至子查询或者视图,作为投影列;也即设置子查询或视图投影列,将t1的所需数据投影至子查询或者视图。Step S406, project the data column to the subquery or view as the projection column; that is, set the subquery or view projection column, and project the required data of t1 to the subquery or view.
步骤S408,将非重复查询操作转换为分组聚集子查询;也即通过新建的子查询或者视图来替代t1,aggdistinct转换为group by。In step S408, the non-repeated query operation is converted into a grouped aggregation subquery; that is, t1 is replaced by a newly created subquery or view, and aggdistinct is converted into group by.
步骤S410,更新分组聚集子查询中的列位置信息,包括将分组聚集子查询groupby以及父查询中列位置信息等,消除上述转换过程中的列位置错位。Step S410, updating the column position information in the grouping aggregation subquery, including grouping the grouping aggregation subquery groupby and the column position information in the parent query, etc., to eliminate the column position misalignment in the above conversion process.
步骤S412,优化器继续优化工作。In step S412, the optimizer continues the optimization work.
发明人对本实施例的方法进行了大量测试,取得了极好的测试结果。例如查询语句为select count(distinct name)from t1,对于t1表数据量一千五百万,name列数据重复度96%的情况;在应用本方案前的执行时间为:165.243s;应用本方案进行等价逻辑变换后,时间缩短为:7.11s。由此可见数据库的查询性能大大提升。The inventor has conducted a large number of tests on the method of this embodiment, and obtained excellent test results. For example, the query statement is select count(distinct name) from t1. For the case where the data volume of t1 table is 15 million and the data repetition degree of name column is 96%; the execution time before applying this scheme is: 165.243s; apply this scheme After the equivalent logic transformation, the time is shortened to: 7.11s. This shows that the query performance of the database is greatly improved.
本实施例还提供了一种机器可读存储介质和计算机设备。图5是根据本发明一个实施例的机器可读存储介质50的示意图,图6是根据本发明一个实施例的计算机设备60的示意图。This embodiment also provides a machine-readable storage medium and computer equipment. FIG. 5 is a schematic diagram of a machine-readable storage medium 50 according to one embodiment of the present invention, and FIG. 6 is a schematic diagram of a computer device 60 according to one embodiment of the present invention.
机器可读存储介质50其上存储有机器可执行程序51,机器可执行程序51被处理器执行时实现上述任一实施例的数据库处理查询语句的方法。The machine-readable storage medium 50 stores a machine-executable program 51 thereon. When the machine-executable program 51 is executed by a processor, the method for processing a query statement in a database in any of the above-mentioned embodiments is implemented.
计算机设备60可以包括存储器620、处理器610及存储在存储器620上并在处理器610上运行的机器可执行程序51,并且处理器610执行机器可执行程序51时实现上述任一实施例的数据库处理查询语句的方法。The computer device 60 may include a memory 620, a processor 610, and a machine-executable program 51 stored on the memory 620 and run on the processor 610, and when the processor 610 executes the machine-executable program 51, the database of any of the above-mentioned embodiments may be realized Method for processing query statements.
需要说明的是,在流程图中表示或在此以其他方式描述的逻辑和/或步骤,例如,可以被认为是用于实现逻辑功能的可执行指令的定序列表,可以具体实现在任何机器可读存储介质中,以供指令执行系统、装置或设备(如基于计算机的系统、包括处理器的系统或其他可以从指令执行系统、装置或设备取指令并执行指令的系统)使用,或结合这些指令执行系统、装置或设备而使用。It should be noted that the logic and/or steps shown in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any machine In a readable storage medium for use by an instruction execution system, device or device (such as a computer-based system, a system including a processor, or other systems that can fetch instructions from an instruction execution system, device or device and execute instructions), or in combination with These instructions are used to execute systems, devices, or equipment.
就本实施例的描述而言,机器可读存储介质50可以是任何可以包含、存储、通信、传播或传输程序以供指令执行系统、装置或设备或结合这些指令执行系统、装置或设备而使用的装置。计算机可读介质的更具体的示例(非穷尽性列表)包括以下:具有一个或多个布线的电连接部(电子装置),便携式计算机盘盒(磁装置),随机存取存储器(RAM),只读存储器(ROM),可擦除可编辑只读存储器(EPROM或闪速存储器),光纤装置,以及便携式光盘只读存储器(CDROM)。另外,计算机可读介质50甚至可以是可在其上打印所述程序的纸或其他合适的介质,因为可以例如通过对纸或其他介质进行光学扫描,接着进行编辑、解译或必要时以其他合适方式进行处理来以电子方式获得所述程序,然后将其存储在计算机存储器中。As far as the description of this embodiment is concerned, the machine-readable storage medium 50 can be any program that can contain, store, communicate, disseminate or transmit programs for instruction execution systems, devices, or devices or for use in combination with these instruction execution systems, devices, or devices. installation. More specific examples (non-exhaustive list) of computer-readable media include the following: electrical connection with one or more wires (electronic device), portable computer disk case (magnetic device), random access memory (RAM), Read Only Memory (ROM), Erasable and Editable Read Only Memory (EPROM or Flash Memory), Fiber Optic Devices, and Portable Compact Disc Read Only Memory (CDROM). In addition, the computer readable medium 50 may even be paper or other suitable medium on which the program may be printed, as it may be possible, for example, by optically scanning the paper or other medium, followed by editing, interpretation, or other processing as necessary. Processed in a suitable manner to obtain the program electronically and store it in a computer memory.
应当理解,本发明的各部分可以用硬件、软件、固件或它们的组合来实现。在上述实施方式中,多个步骤或方法可以用存储在存储器中且由合适的指令执行系统执行的软件或固件来实现。It should be understood that various parts of the present invention can be realized by hardware, software, firmware or their combination. In the embodiments described above, various steps or methods may be implemented by software or firmware stored in memory and executed by a suitable instruction execution system.
计算机设备60可以是例如服务器、台式计算机、笔记本式计算机、平板计算机或智能手机。在一些示例中,计算机设备60可以是云计算节点。计算机设备60可以在由计算机系统执行的计算机系统可执行指令(诸如程序模块)的一般语境下描述。通常,程序模块可以包括执行特定的任务或者实现特定的抽象数据类型的例程、程序、目标程序、组件、逻辑、数据结构等。计算机设备60可以在通过通信网络链接的远程处理设备执行任务的分布式云计算环境中实施。在分布式云计算环境中,程序模块可以位于包括存储设备的本地或远程计算系统存储介质上。The computer device 60 may be, for example, a server, a desktop computer, a notebook computer, a tablet computer or a smartphone. In some examples, computer device 60 may be a cloud computing node. Computer device 60 may be described in the general context of computer system-executable instructions, such as program modules, being executed by a computer system. Generally, program modules may include routines, programs, objects, components, logic, data structures, etc. that perform particular tasks or implement particular abstract data types. Computer device 60 can be practiced in a distributed cloud computing environment where tasks are performed by remote processing devices that are linked through a communications network. In a distributed cloud computing environment, program modules may be located in both local and remote computing system storage media including storage devices.
计算机设备60可以包括适于执行存储的指令的处理器610、在操作期间为所述指令的操作提供临时存储空间的存储器620。处理器610可以是单核处理器、多核处理器、计算集群或任何数量的其他配置。存储器620可以包括随机存取存储器(RAM)、只读存储器、闪存或任何其他合适的存储系统。The computer device 60 may include a processor 610 adapted to execute stored instructions, a memory 620 providing temporary storage for operations of the instructions during operation. Processor 610 may be a single-core processor, a multi-core processor, a computing cluster, or any number of other configurations. Memory 620 may include random access memory (RAM), read only memory, flash memory, or any other suitable storage system.
处理器610可以通过系统互连(例如PCI、PCI-Express等)连接到适于将计算机设备60连接到一个或多个I/O设备(输入/输出设备)的I/O接口(输入/输出接口)。I/O设备可以包括例如键盘和指示设备,其中指示设备可以包括触摸板或触摸屏等等。I/O设备可以是计算机设备60的内置组件,或者可以是外部连接到计算设备的设备。Processor 610 may be connected by a system interconnect (e.g., PCI, PCI-Express, etc.) to an I/O interface (input/output device) suitable for connecting computer device 60 to one or more I/O devices (input/output device). interface). I/O devices may include, for example, a keyboard and a pointing device, where the pointing device may include a touch pad or a touch screen, among others. The I/O devices may be built-in components of the computing device 60, or may be devices externally connected to the computing device.
处理器610也可以通过系统互连链接到适于将计算机设备60连接到显示设备的显示接口。显示设备可以包括作为计算机设备60的内置组件的显示屏。显示设备还可以包括外部连接到计算机设备60的计算机监视器、电视机或投影仪等。此外,网络接口控制器(network interface controller,NIC)可以适于通过系统互连将计算机设备60连接到网络。在一些实施例中,NIC可以使用任何合适的接口或协议(诸如因特网小型计算机系统接口等)来传输数据。网络可以是蜂窝网络、无线电网络、广域网(WAN)、局域网(LAN)或因特网等等。远程设备可以通过网络连接到计算设备。Processor 610 may also be linked through a system interconnect to a display interface suitable for connecting computer device 60 to a display device. The display device may include a display screen as a built-in component of the computer device 60 . The display device may also include a computer monitor, a television, or a projector, etc. externally connected to the computer device 60 . Additionally, a network interface controller (NIC) may be adapted to connect computer device 60 to a network through a system interconnect. In some embodiments, the NIC may use any suitable interface or protocol (such as Internet Small Computer System Interface, etc.) to transfer data. The network may be a cellular network, a radio network, a wide area network (WAN), a local area network (LAN), or the Internet, among others. The remote device can be connected to the computing device through a network.
本实施例提供的流程图并不旨在指示方法的操作将以任何特定的顺序执行,或者方法的所有操作都包括在所有的每种情况下。此外,方法可以包括附加操作。在本实施例方法提供的技术思路的范围内,可以对上述方法进行附加的变化。The flowcharts provided in the present embodiments are not intended to indicate that the operations of the methods will be performed in any particular order, or that all operations of the methods are included in every instance. Additionally, the methods may include additional operations. Within the scope of the technical idea provided by the method of this embodiment, additional changes can be made to the above method.
至此,本领域技术人员应认识到,虽然本文已详尽示出和描述了本发明的多个示例性实施例,但是,在不脱离本发明精神和范围的情况下,仍可根据本发明公开的内容直接确定或推导出符合本发明原理的许多其他变型或修改。因此,本发明的范围应被理解和认定为覆盖了所有这些其他变型或修改。So far, those skilled in the art should appreciate that, although a number of exemplary embodiments of the present invention have been shown and described in detail herein, without departing from the spirit and scope of the present invention, the disclosed embodiments of the present invention can still be used. Many other variations or modifications consistent with the principles of the invention are directly identified or derived from the content. Accordingly, the scope of the present invention should be understood and deemed to cover all such other variations or modifications.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210944105.7A CN115328939A (en) | 2022-08-05 | 2022-08-05 | Method for processing query statement by database, storage medium and computer equipment |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210944105.7A CN115328939A (en) | 2022-08-05 | 2022-08-05 | Method for processing query statement by database, storage medium and computer equipment |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN115328939A true CN115328939A (en) | 2022-11-11 |
Family
ID=83921308
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202210944105.7A Pending CN115328939A (en) | 2022-08-05 | 2022-08-05 | Method for processing query statement by database, storage medium and computer equipment |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN115328939A (en) |
Cited By (10)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115934760A (en) * | 2022-12-29 | 2023-04-07 | 北京人大金仓信息技术股份有限公司 | Method for optimizing database query statement, storage medium and computer equipment |
| CN115934804A (en) * | 2022-12-29 | 2023-04-07 | 深信服科技股份有限公司 | Statistical method, device, electronic equipment and storage medium for SQL statements |
| CN116204550A (en) * | 2023-02-17 | 2023-06-02 | 北京人大金仓信息技术股份有限公司 | Database query statement optimization method, storage medium and device |
| CN116303606A (en) * | 2023-03-03 | 2023-06-23 | 北京人大金仓信息技术股份有限公司 | Method, storage medium and device for generating database operation statement execution plan |
| CN116303579A (en) * | 2023-03-29 | 2023-06-23 | 北京人大金仓信息技术股份有限公司 | Database query optimization method, storage medium and equipment |
| CN116401277A (en) * | 2023-03-23 | 2023-07-07 | 阿里巴巴(中国)有限公司 | Data processing method, device, system, equipment and medium |
| CN116414866A (en) * | 2023-04-18 | 2023-07-11 | 北京人大金仓信息技术股份有限公司 | Optimization method, storage medium and equipment for database operation statement |
| CN116431672A (en) * | 2023-04-18 | 2023-07-14 | 北京人大金仓信息技术股份有限公司 | Predicate logic optimization method, storage medium and equipment of database operation statement |
| CN116610697A (en) * | 2023-05-31 | 2023-08-18 | 北京人大金仓信息技术股份有限公司 | Query method, storage medium and equipment for database query statement |
| CN118296001A (en) * | 2024-03-29 | 2024-07-05 | 镁佳(北京)科技有限公司 | Data query method, device, computer equipment, storage medium and program product |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108304505A (en) * | 2018-01-18 | 2018-07-20 | 上海达梦数据库有限公司 | A kind of processing method of SQL statement, device, server and storage medium |
| US20190251196A1 (en) * | 2018-02-09 | 2019-08-15 | International Business Machines Corporation | Transforming a scalar subquery |
| CN114297233A (en) * | 2021-12-31 | 2022-04-08 | 北京人大金仓信息技术股份有限公司 | Database query method, database query device, electronic device, medium, and program product |
-
2022
- 2022-08-05 CN CN202210944105.7A patent/CN115328939A/en active Pending
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108304505A (en) * | 2018-01-18 | 2018-07-20 | 上海达梦数据库有限公司 | A kind of processing method of SQL statement, device, server and storage medium |
| US20190251196A1 (en) * | 2018-02-09 | 2019-08-15 | International Business Machines Corporation | Transforming a scalar subquery |
| CN114297233A (en) * | 2021-12-31 | 2022-04-08 | 北京人大金仓信息技术股份有限公司 | Database query method, database query device, electronic device, medium, and program product |
Non-Patent Citations (2)
| Title |
|---|
| _ETHANLIU: "sql优化之count distinct vs. count group by", Retrieved from the Internet <URL:https://blog.csdn.net/liu123641191/article/details/80380542> * |
| 工业狂魔: "hive中groupby优化_HiveSQL常用优化方法", Retrieved from the Internet <URL:https://blog.csdn.net/weixin_28911479/article/details/112226196> * |
Cited By (11)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115934760A (en) * | 2022-12-29 | 2023-04-07 | 北京人大金仓信息技术股份有限公司 | Method for optimizing database query statement, storage medium and computer equipment |
| CN115934804A (en) * | 2022-12-29 | 2023-04-07 | 深信服科技股份有限公司 | Statistical method, device, electronic equipment and storage medium for SQL statements |
| CN116204550A (en) * | 2023-02-17 | 2023-06-02 | 北京人大金仓信息技术股份有限公司 | Database query statement optimization method, storage medium and device |
| CN116303606A (en) * | 2023-03-03 | 2023-06-23 | 北京人大金仓信息技术股份有限公司 | Method, storage medium and device for generating database operation statement execution plan |
| CN116401277A (en) * | 2023-03-23 | 2023-07-07 | 阿里巴巴(中国)有限公司 | Data processing method, device, system, equipment and medium |
| CN116303579A (en) * | 2023-03-29 | 2023-06-23 | 北京人大金仓信息技术股份有限公司 | Database query optimization method, storage medium and equipment |
| CN116414866A (en) * | 2023-04-18 | 2023-07-11 | 北京人大金仓信息技术股份有限公司 | Optimization method, storage medium and equipment for database operation statement |
| CN116431672A (en) * | 2023-04-18 | 2023-07-14 | 北京人大金仓信息技术股份有限公司 | Predicate logic optimization method, storage medium and equipment of database operation statement |
| CN116610697A (en) * | 2023-05-31 | 2023-08-18 | 北京人大金仓信息技术股份有限公司 | Query method, storage medium and equipment for database query statement |
| CN118296001A (en) * | 2024-03-29 | 2024-07-05 | 镁佳(北京)科技有限公司 | Data query method, device, computer equipment, storage medium and program product |
| CN118296001B (en) * | 2024-03-29 | 2024-11-05 | 镁佳(北京)科技有限公司 | Data query method, device, computer equipment, storage medium and program product |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN115328939A (en) | Method for processing query statement by database, storage medium and computer equipment | |
| CN113051268B (en) | Data query method, data query device, electronic device and storage medium | |
| CN114357276B (en) | Data query method, device, electronic equipment and storage medium | |
| CN114547095A (en) | A method, device, electronic device and storage medium for fast data query | |
| CN114139040A (en) | A data storage and query method, apparatus, device and readable storage medium | |
| CN115391424A (en) | Database query processing method, storage medium and computer equipment | |
| CN115934760A (en) | Method for optimizing database query statement, storage medium and computer equipment | |
| CN104731911A (en) | Dynamic mapping and converting method for data table and entity class | |
| CN112015831A (en) | Method, device and equipment for operating relational database based on C language | |
| CN115374121A (en) | Database index generation method, machine-readable storage medium and computer equipment | |
| CN116257552A (en) | Optimization method, storage medium and equipment for database query statement | |
| CN115757479A (en) | Database query optimization method, machine-readable storage medium and computer device | |
| CN115391346A (en) | Database aggregation index generation method, storage medium and computer equipment | |
| CN115481148A (en) | Optimization method of database connection operation, storage medium and computer equipment | |
| CN115048409A (en) | Execution method of database connection operation, storage medium and computer device | |
| CN116431672A (en) | Predicate logic optimization method, storage medium and equipment of database operation statement | |
| CN112307062B (en) | Database aggregation query method, device and system | |
| CN116204550A (en) | Database query statement optimization method, storage medium and device | |
| CN106777278B (en) | Spark-based data processing method and device | |
| CN110019342A (en) | Partition table access method, device and equipment, computer readable storage medium | |
| WO2018059430A1 (en) | Database searching | |
| CN115391363A (en) | Database index updating method, storage medium and computer equipment | |
| CN110069489B (en) | An information processing method, device, device, and computer-readable storage medium | |
| CN115470220A (en) | Database index updating method, storage medium and computer equipment | |
| CN117076491A (en) | A data processing method, storage medium and equipment |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| CB02 | Change of applicant information | ||
| CB02 | Change of applicant information |
Country or region after: China Address after: 100102 201, 2 / F, 101, No. 5 building, No. 7 Rongda Road, Chaoyang District, Beijing Applicant after: China Electronics Technology Group Jincang (Beijing) Technology Co.,Ltd. Address before: 100102 201, 2 / F, 101, No. 5 building, No. 7 Rongda Road, Chaoyang District, Beijing Applicant before: BEIJING KINGBASE INFORMATION TECHNOLOGIES Inc. Country or region before: China |