WO2018153210A1 - 一种自动创建索引的方法、装置及数据库系统 - Google Patents

一种自动创建索引的方法、装置及数据库系统 Download PDF

Info

Publication number
WO2018153210A1
WO2018153210A1 PCT/CN2018/074134 CN2018074134W WO2018153210A1 WO 2018153210 A1 WO2018153210 A1 WO 2018153210A1 CN 2018074134 W CN2018074134 W CN 2018074134W WO 2018153210 A1 WO2018153210 A1 WO 2018153210A1
Authority
WO
WIPO (PCT)
Prior art keywords
index
data
data table
target data
distribution
Prior art date
Application number
PCT/CN2018/074134
Other languages
English (en)
French (fr)
Inventor
谢东
Original Assignee
中兴通讯股份有限公司
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 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2018153210A1 publication Critical patent/WO2018153210A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures

Definitions

  • the present invention relates to the field of database technologies, and in particular, to a method, an apparatus, and a database system for automatically creating an index.
  • a relational database is a database based on a relational database model that processes data in a database by means of concepts and methods such as collection algebra. With the development of information technology, relational databases have been widely used in various industries.
  • indexes are pre-created based on designer experience. However, as time goes by, the demand for data usage may change. In general, in relational databases, indexes are created based on requirements gathering and designer experience. Inaccurate collection of requirements or inexperienced designers may result in inaccurate, unreasonable, and inefficient indexes. Therefore, there is a need for an efficient and more flexible index creation method and apparatus.
  • the invention provides a method, a device and a database system for automatically creating an index, which are used to solve the problem of low efficiency and low flexibility in the existing index creation method.
  • a method for automatically creating an index includes:
  • the operation condition is used as an index of the target data table.
  • the step of analyzing the target data table in the data query statement and the operating conditions includes:
  • the target data table and the operating condition are obtained according to a grammar rule of the data query statement.
  • the step of determining whether the data distribution needs to be analyzed includes:
  • the target data table exists in the preset data table white list, it is determined according to the creation basis whether the data distribution needs to be analyzed, and when the target data table does not exist in the preset data table white list, the creation of the The index of the target data table.
  • the step of calculating a distribution of the table data in the target data table that satisfies the operating condition includes:
  • the step of creating the index of the target data table with the operating condition includes:
  • the single index is used as an index of the target data table; when the ratio of the result set of the composite index and the result set of the single index is not greater than a preset threshold, the composite is As an index of the target data table.
  • the method further includes:
  • Real-time monitoring whether at least one of the data query statement and the data table in the database changes wherein when at least one of the data query statement and the data table in the database is detected to change, the change is established according to the change At least one of an index operation and an delete index operation.
  • the method further includes:
  • the index of the target data table is directly created with the operation condition.
  • the operating condition includes a condition corresponding to any one or more of a WHERE screening statement, a GROUP BY grouping statement, and an ORDER BY sorting statement.
  • an apparatus for automatically creating an index includes:
  • An analysis unit for analyzing a target data table and operating conditions in the data query statement
  • a calculating unit configured to determine whether it is necessary to analyze the data distribution, wherein, when determining that the data distribution needs to be analyzed, the calculating unit calculates a distribution of the table data in the target data table that satisfies the operating condition;
  • a creating unit configured to create an index of the target data table by using the operating condition when a distribution of the table data satisfies a preset index creation policy.
  • the analyzing unit is further configured to:
  • the target data table and the operating condition are obtained according to the syntax rule of the data query statement.
  • the computing unit is further configured to:
  • the basis for creating the index creation policy is obtained, and determining whether the target data table exists in a preset white list of the data table according to the creation basis, wherein
  • the target data table exists in the preset data table white list, it is determined according to the creation basis whether the data distribution needs to be analyzed, and when the target data table does not exist in the preset data table white list, the creation of the The index of the target data table.
  • the computing unit is further configured to:
  • the distribution of the table data is calculated using a preset statistical device.
  • the creating unit is further configured to:
  • the single index is used as an index of the target data table; when the ratio of the result set of the composite index and the result set of the single index is not greater than a preset threshold, the composite is As an index of the target data table.
  • the apparatus further includes a monitoring unit for:
  • the creating unit is further configured to:
  • the index of the target data table is directly created with the operation condition.
  • the operating condition includes a condition corresponding to any one or more of a WHERE screening statement, a GROUP BY grouping statement, and an ORDER BY sorting statement.
  • a database system comprising the apparatus for automatically creating an index as described above.
  • FIG. 1 is a flowchart of an automatic index creation method according to an embodiment of the present invention
  • FIG. 2 is a flow chart showing the execution of an INSERT statement provided in accordance with the present invention.
  • FIG. 3 is a flow diagram showing the execution of a new SQL statement provided in accordance with the present invention.
  • FIG. 4 is a schematic structural diagram of an automatic index creation apparatus according to an embodiment of the present invention.
  • FIG. 5 is a schematic diagram of a data distribution model provided in accordance with the present invention.
  • FIG. 6 is a schematic diagram of a data consumption model provided in accordance with the present invention.
  • the database application model can be established by analyzing the logical relationship of the data, designing the table structure, analyzing the usage scenarios of the database, estimating possible SQL statements in advance, and analyzing possible query conditions, and then selecting one of the tables or Multiple columns are used as index fields to create an index.
  • the index is pre-created based on the designer's experience. Inaccurate collection of requirements or inexperienced designers may result in inaccurate, unreasonable, and inefficient indexes.
  • One embodiment of the present invention provides a method of automatically creating an index. As shown in FIG. 1, the method for automatically creating an index includes the following steps:
  • Step S101 analyzing the target data table and the operating conditions in the data query statement
  • Step S102 determining whether it is necessary to analyze the data distribution, wherein when it is determined that the data distribution needs to be analyzed, calculating a distribution of the table data in the target data table that satisfies the operating condition;
  • Step S103 When the distribution of the table data satisfies a preset index creation policy, the index of the target data table is created by using the operation condition.
  • the data query statement is a SQL statement.
  • the SQL statement is automatically obtained.
  • Data can be obtained from the application or from the relevant data dictionary table in the database. For a data table, you need to get as many relevant SQL statements as possible to build an efficient and comprehensive index.
  • the split SQL statement includes the target data table name and the operating conditions.
  • the operating conditions may include conditions corresponding to the WHERE screening statement, the GROUP BY grouping statement, and the ORDER BY sorting statement.
  • the analysis results are classified and saved according to the data sheet.
  • the step of analyzing the target data table in the data query statement and the operating conditions specifically includes:
  • invalid SQL statements can be pre-excluded, thereby effectively increasing the speed of creating an index.
  • the steps to determine if you need to analyze the data distribution include:
  • the index creation strategy refers to the creation of index expert knowledge (conditions or rules to be created by creating an index), and the index expert knowledge is pre-defined and can be regularly maintained, for example, added, modified, and deleted.
  • the creation strategy here consists of SQL statements, SQL statements and data distribution, and pre-defined rules. Of course, you can also use other index creation strategies, which are not limited here.
  • the field to be operated is used as the index of the target data table.
  • a SQL statement for a key-value query needs to be indexed with a WHERE condition field.
  • an index is created according to a predefined rule, it is determined according to a predefined rule whether an index needs to be established. For example, depending on the actual operation of the application, it is prohibited to create indexes on tables that frequently insert data.
  • the step of calculating the distribution of the table data that meets the operating conditions in the target data table specifically includes:
  • the scanning strategy herein includes information such as predetermined trigger conditions and/or scan granularity.
  • Trigger conditions can include timed scans and new SQL statements.
  • the system can automatically create an index corresponding to it, or delete an index that is no longer needed.
  • the scan granularity can include all scans and samples by percentage of data.
  • the analysis data includes the fields of the operation, the type of data for each field, the distribution of the data for each field, and the cardinality of the data.
  • the distribution of data includes the number of columns (the fields to which the data is divided), and the statistics of the maximum, minimum, average, and variance of each column of data. Data can also be distributed discretely. The steps of reading, scanning, and calculating can be performed simultaneously to take full advantage of the relational computing power of the database. The results calculated for each column of data are sorted and saved according to the data table.
  • the index creation policy needs to determine whether the preset establishment conditions are met according to the data distribution. When the preset establishment condition is met, the index can be further created. By setting the conditions by default, you can ensure that an efficient index is established:
  • the single index is used as an index of the target data table; when the ratio of the result set of the composite index and the result set of the single index is not greater than a preset threshold, the composite cable is used as a The index of the target data table.
  • a composite index here refers to an index that includes multiple operating conditions.
  • the leader of a composite index refers to a single index created by the most efficient operating conditions. The manner in which the above index is established will be described later in a specific embodiment.
  • the SQL statement can be executed with the highest efficiency.
  • the method for automatically creating an index provided by the present invention by analyzing the composition structure of the current SQL statement, an index is automatically created for the SQL statement based on the distribution of the table data in the table. Compared with the conventional manual analysis method for estimating the index, the method for automatically creating an index provided by the present invention has higher accuracy and can improve the execution efficiency of the SQL statement.
  • the method for automatically creating an index of the present invention will be described below with reference to specific embodiments.
  • the information is recorded in the call log table, and the call log needs to be queried.
  • the user calls a log log (calllog), wherein the main fields of the calllog include: a serial number, a calling number, a called number, a starting time, an ending time, and details.
  • the system needs to meet the details of a user's query within a certain period of time. For example, when the system queries the call log table of a certain day according to the calling number, the SQL statement is as follows:
  • WHERE conditional parts including:
  • the GROUP BY grouping part is empty
  • the ORDER BY sorting part is empty
  • Range filtering is performed on the field sdate, and the operation condition is sdate in the interval [2016-02-01 00:00:00, 2016-02-02 00:00:00].
  • the corresponding strategy is read based on the SQL analysis result and the data distribution result.
  • Strategy 1 In the case of multiple screening conditions, the conditions with high screening efficiency are placed first and thus more efficient.
  • Condition 1 is 0.0005%, the screening efficiency is high, and the result of Condition 2 is 1.9%, and the screening efficiency is low. Therefore, the order of the fields in the index is: cno, sdate. Therefore, the index considering all the filter conditions is index one, namely calllog(cno, sdate).
  • the method for automatically creating an index provided by the embodiment of the present invention further includes:
  • Real-time monitoring whether at least one of the data query statement and the data table in the database changes wherein when at least one of the data query statement and the data table in the database is detected to change, the change is established according to the change At least one of an index operation and an delete index operation.
  • the distribution of the table data in the table is recalculated.
  • the calculation method can be either incremental calculation or full calculation. Re-indexing based on the recalculated data distribution.
  • the process of executing an INSERT statement is taken as an example.
  • the process includes the following steps:
  • Step S201 starting data collection
  • Step S202 executing an INSERT statement, wherein the database application collects the data from the data source to the data set, encapsulates it into an INSERT statement, and then sends the data to the database for execution; after the execution is completed, the data is saved to the database table;
  • Step S203 calculating a data distribution, wherein detecting a change of the table data in the database, recalculating the distribution index of the data in the table; the calculation manner may configure the policy, for example, may be an incremental calculation or a full calculation; the calculation result will be As the basis for automatically creating an index;
  • Figure 3 shows a schematic diagram of the flow of executing a new SQL statement. As shown in FIG. 3, the method mainly includes the following steps:
  • Step S301 starting.
  • Step S302 analyzing an index required by the new SQL statement, wherein by analyzing the WHERE filter condition part, the GROUP BY group part, and the ORDER BY sorting part in the SQL statement, the manner of creating the index is obtained to make the SQL statement the most efficient;
  • Step S303 determining whether there is a corresponding index based on the table index definition information, wherein if there is no corresponding index, proceeding to step S304 to create an index; if there is a corresponding index, proceeding to step S305 without creating an index;
  • Step S304 automatically creating an index
  • Step S305 executing a SQL statement, wherein the database executes the SQL statement and returns the calculation result to the database application.
  • the system can automatically create an index corresponding to it, delete the index that is no longer needed; when the data distribution is different and/or the data base number in the column is not the same, The invented method of automatically creating an index can automatically adapt to this change, delete an index that is no longer suitable, and create a valid index.
  • An embodiment of the present invention also provides an apparatus for automatically creating an index.
  • the apparatus for automatically creating an index includes:
  • the analyzing unit 41 is configured to analyze the target data table and the operating conditions in the data query statement;
  • the calculating unit 42 is configured to determine whether it is necessary to analyze the data distribution, wherein when determining that the data distribution needs to be analyzed, the calculating unit 42 calculates a distribution of the table data in the target data table that satisfies the operating condition;
  • a creating unit 43 configured to: when the distribution of the table data meets a preset index creation policy, create an index of the target data table by using the operating condition; or when it is determined that the data distribution is not required to be analyzed, directly The operating condition is used to create an index of the target data table.
  • the operating condition includes a condition corresponding to any one or more of a WHERE screening statement, a GROUP BY grouping statement, and an ORDER BY sorting statement.
  • the analyzing unit 41 is specifically configured to:
  • the target data table and the operating condition are obtained according to a grammar rule of the data query statement.
  • the computing unit 42 is specifically configured to:
  • the basis for creating the index creation policy is obtained, and determining whether the target data table exists in the preset data table white list according to the creation basis, wherein
  • the target data table exists in the preset data table white list, it is determined according to the creation basis whether the data distribution needs to be analyzed, and when the target data table does not exist in the preset data table white list, the creation of the stop is stopped.
  • the index of the target data table is stopped.
  • the computing unit 42 is specifically configured to:
  • the distribution of the table data is calculated using a preset statistical device.
  • the creating unit 43 is specifically configured to:
  • the apparatus further includes a monitoring unit for:
  • the change of at least one of the data query statement and the data table in the database and the data table in the database changes in real time.
  • at least one of the data query statement and the data table in the database is detected to change, at least one of an indexing operation and an indexing operation is performed according to the change.
  • the present invention also provides a database system including an automatic creation indexing device according to the above embodiment.
  • the system can be applied to data publishing models and data consumption models.
  • FIG. 5 is a schematic structural diagram of a data distribution model provided in accordance with the present invention.
  • the database application acts as the publisher.
  • the data release model includes the following sections:
  • a publisher configured to collect data from a data source into a data set and send it to a database system
  • a database configured to hold data sets and perform data management
  • An indexing device is automatically created and configured to perform the automatic index creation method described above.
  • FIG. 6 is a block diagram showing the structure of a data consumption model provided in accordance with the present invention.
  • data collected from the data source to the system can be provided to the application for use.
  • the data consumption model usage scenario includes querying, modifying, and deleting data in the database.
  • the consumption model includes the following sections:
  • the consumer is configured to convert the user's data usage request into a SQL statement such as query/modify/delete, send the SQL statement to the database system for execution, and return the result;
  • Automatically creating an indexing device configured to obtain the SQL statement, wherein if there is no index required, the index is automatically created and the data in the database is monitored simultaneously, wherein if the data in the database changes, the data is recalculated in the table Distribution in ;
  • a database constructed to calculate the saved data and return the calculated data to the application.
  • the database system provided by the present invention can optimize the database design.
  • Operations on data include storage and use.
  • the application belongs to the publisher of the data; when using the data, the application belongs to the consumer of the data.
  • publishers focus on data structures; consumers are more concerned with indexing.
  • the composition structure of the SQL statement can be automatically analyzed, and the index is automatically created for use by the SQL statement based on the table composition structure and the distribution of the data in the table. Consumers are no longer limited by the limitations of fixed indexes in the early stages of system construction, making database design more reasonable.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本发明公开了一种自动创建索引的方法、装置及数据库系统。该方法包括:分析数据查询语句中的目标数据表以及操作条件;判断是否需要分析数据分布,其中,当判断需要分析数据分布时,计算目标数据表中满足操作条件的表数据的分布情况;以及当表数据的分布情况满足预设的索引创建策略时,用操作条件创建目标数据表的索引。摘图1

Description

一种自动创建索引的方法、装置及数据库系统 技术领域
本发明涉及数据库技术领域,尤其涉及一种自动创建索引的方法、装置及数据库系统。
背景技术
关系数据库是建立在关系数据库模型基础上的数据库,借助于集合代数等概念和方法来处理数据库中的数据。随着信息技术发展,关系数据库在各行各业得到了广泛应用。
在常规数据库中,索引是根据设计者经验预先创建的。然而,随着时间的推移,人们对数据使用的需求可能会发生变化。一般来说,在关系数据库中,依据需求收集和设计者经验能力来创建索引。如果需求收集不准确或者设计者经验不足,可能会导致索引不准确、不合理并且效率低下。因此,需要效率更高且灵活性更强的索引创建方法和装置。
发明内容
本发明提供一种自动创建索引的方法、装置及数据库系统,用以解决现有的索引创建方法中创建效率低和灵活性低的问题。
依据本发明的一个方面,提供一种自动创建索引的方法,包括:
分析数据查询语句中的目标数据表以及操作条件;
判断是否需要分析数据分布,其中,当判断需要分析数据分布时,计算所述目标数据表中满足所述操作条件的表数据的分布情况;以及
当所述表数据的分布情况满足预设的索引创建策略时,用所述操作条件创建为所述目标数据表的索引。
在一个示例性实施例中,分析数据查询语句中的目标数据表以及操作条件的步骤包括:
对所述数据查询语句进行语法检查,以判断所述数据查询语句是否为有效语句,其中
当判定所述数据查询语句为有效语句时,根据所述数据查询语句的语法规则获取所述目标数据表以及所述操作条件。
在一个示例性实施例中,判断是否需要分析数据分布的步骤包括:
获取所述索引创建策略的创建依据,根据所述创建依据判断所述目标数据表是否存在于预设的数据表白名单中,其中
当所述目标数据表存在于预设的数据表白名单时,则根据所述创建依据判断是否需要分析数据分布,当所述目标数据表不存在于预设的数据表白名单时,停止创建所述目标数据表的索引。
在一个示例性实施例中,计算所述目标数据表中满足所述操作条件的表数据的分布情况的步骤包括:
读取预设的表数据扫描策略;
根据所述预设的扫描策略从所述目标数据表中获取满足所述操作条件的表数据;以及
根据预设的统计方法计算所述表数据的分布情况。
在一个示例性实施例中,当所述表数据的分布情况满足预设的索引创建策略时,用所述操作条件创建为所述目标数据表的索引的步骤包括:
根据所述表数据的分布情况获取各个操作条件的筛选效率,按照筛选效率的从高到低的顺序将所述操作条件进行排序,并且根据排序后的所述操作条件建立复合索引;
用所述复合索引的先导创建单一索引;以及
判断所述复合索引的结果集和所述单一索引的结果集的占比是否大于预设阈值时,其中,当所述复合索引的结果集和所述单一索引的结果集的占比大于所述预设阈值时,则将所述单一索引作为所述目标数据表的索引;当所述复合索引的结果集和所述单一索引的结果集的占比不大于预设阈值时,将所述复合索作为所述目标数据表的索引。
在一个示例性实施例中,在用所述操作条件创建为所述目标数据表的索引之后,所述方法还包括:
实时监测数据查询语句和数据库中的数据表中的至少一者的是否发生变化,其中,当监测到数据查询语句和数据库中的数据表中的至 少一者发生变化时,则根据变化情况进行建立索引操作和删除索引操作中的至少一种操作。
在一个示例性实施例中,所述方法还包括:
当判断不需要分析数据分布时,则直接用所述操作条件创建所述目标数据表的索引。
在一个示例性实施例中,所述操作条件包括WHERE筛选语句、GROUP BY分组语句和ORDER BY排序语句中的任意一种或多种操作所对应的条件。
依据本发明的一个方面,提供一种自动创建索引的装置,包括:
分析单元,用于分析数据查询语句中的目标数据表以及操作条件;
计算单元,用于判断是否需要分析数据分布,其中,当判断需要分析数据分布时,所述计算单元计算所述目标数据表中满足所述操作条件的表数据的分布情况;以及
创建单元,用于当所述表数据的分布情况满足预设的索引创建策略时,用所述操作条件创建所述目标数据表的索引。
在一个示例性实施例中,所述分析单元还用于:
对所述数据查询语句进行语法检查,以判断所述数据查询语句是否为有效语句;
当判定所述数据查询语句为有效语句时,根据所述数据查询语句的语法规则获取所述目标数据表以及操作条件。
在一个示例性实施例中,所述计算单元还用于:
判断是否需要分析数据分布时,以获取所述索引创建策略的创建依据,根据所述创建依据判断所述目标数据表是否存在于预设的数据表白名单中,其中
当所述目标数据表存在于预设的数据表白名单时,则根据所述创建依据判断是否需要分析数据分布,当所述目标数据表不存在于预设的数据表白名单时,停止创建所述目标数据表的索引。
在一个示例性实施例中,所述计算单元还用于:
读取预设的表数据扫描策略;
根据所述扫描策略从所述目标数据表中获取满足所述操作条件的 表数据;以及
利用预设的统计装置计算所述表数据的分布情况。
在一个示例性实施例中,所述创建单元还用于:
根据所述表数据的分布情况获取各个操作条件的筛选效率,按照筛选效率的从高到低的顺序将所述操作条件进行排序,并且根据排序后的所述操作条件建立复合索引;
用所述复合索引的先导创建单一索引;以及
判断所述复合索引的结果集和所述单一索引的结果集的占比是否大于预设阈值时,其中,当所述复合索引的结果集和所述单一索引的结果集的占比大于所述预设阈值时,则将所述单一索引作为所述目标数据表的索引;当所述复合索引的结果集和所述单一索引的结果集的占比不大于预设阈值时,将所述复合索作为所述目标数据表的索引。
在一个示例性实施例中,所述装置还包括监测单元,用于:
在用所述操作条件创建为所述目标数据表的索引之后,实时监测数据查询语句和数据库中的数据表中的至少一者数据查询语句和数据库中的数据表中的至少一者的变化,当监测到数据查询语句和数据库中的数据表中的至少一者发生变化时,则根据变化情况进行建立索引操作和删除索引操作中的至少一种操作。
在一个示例性实施例中,所述创建单元还用于:
当判断不需要分析数据分布时,则直接用所述操作条件创建所述目标数据表的索引。
在一个示例性实施例中,所述操作条件包括WHERE筛选语句、GROUP BY分组语句和ORDER BY排序语句中的任意一种或多种操作所对应的条件。
依据本发明的一个方面,还提供了一种数据库系统,包括上述所述的自动创建索引的装置。
上述说明仅是本发明技术方案的概述。为了能够更清楚了解本发明的技术手段,可依照说明书的内容予以实施。此外,提出本发明的一些实施方式以使本发明的上述和其它目的、特征和优点能够更明显 易懂。
附图说明
为了更清楚地说明本发明实施例的技术方案,下面将结合附图对实施例进行详细描述。应当理解的是,附图是示例性的并且仅用于示出本发明的一些实施例。对于本领域普通技术人员而言,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为根据本发明实施例所提供的自动创建索引方法的流程图;
图2为执行根据本发明提供的INSERT语句的流程示意图;
图3为执行根据本发明提供的新的SQL语句的流程示意图;。
图4为根据本发明实施例所提供的自动创建索引装置的结构示意图;
图5为根据本发明提供的数据发布模型的示意图;
图6为根据本发明提供的数据消费模型的示意图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述。显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明的范围。
在一些情况下,可以通过以下方式建立数据库应用模型:分析数据的逻辑关系,设计表结构;分析数据库的使用场景,预先估计可能的SQL语句;以及分析可能的查询条件,然后选取表的一个或者多个列作为索引字段以创建索引。然而,如上文所述,索引是根据设计者经验预先创建的。如果需求收集不准确或者设计者经验不足,可能会导致索引不准确、不合理并且效率低下。
本发明的一个实施例提供一种自动创建索引的方法。如图1所示,所述自动创建索引的方法包括如下步骤:
步骤S101,分析数据查询语句中的目标数据表以及操作条件;
步骤S102,判断是否需要分析数据分布,其中,当判断需要分析数据分布时,计算所述目标数据表中满足所述操作条件的表数据的分布情况;以及
步骤S103,当所述表数据的分布情况满足预设的索引创建策略时,则用所述操作条件创建所述目标数据表的索引。
这里,数据查询语句为SQL语句。当检测到系统启动创建索引命令后,自动获取SQL语句。数据可以从应用程序获取,也可以从数据库的相关数据字典表中获取。对于一张数据表,需要尽可能多地获取相关SQL语句,以便建立高效全面的索引。
在分析获取的SQL语句时,将符合ANSI SQL语法的SQL语句进行拆分,重点考虑与SQL执行效率相关的组成部分。拆分后的SQL语句包括目标数据表名以及操作条件。其中,操作条件可以包括WHERE筛选语句、GROUP BY分组语句、ORDER BY排序语句所对应的条件。分析结果按数据表进行分类和保存。
在一个示例性实施例中,分析数据查询语句中的目标数据表以及操作条件的步骤具体包括:
预先读取表结构信息,并且预先对SQL语句进行语法检查,其中,当所述SQL语句为有效语句时,根据所述数据查询语句的语法规则获取所述目标数据表以及所述操作条件;当所述SQL语句为无效语句时,则不再对所述数据查询语句进行分析。
通过上述步骤,可以预先排除无效SQL语句,从而有效提高创建索引的速度。
判断是否需要分析数据分布的步骤包括:
获取所述索引创建策略的创建依据,根据所述创建依据判断所述目标数据表是否存在于预设的数据表白名单中,其中,当所述目标数据表存在于预设的数据表白名单时,则根据所述创建依据判断是否需要分析数据分布,而当所述目标数据表不存在于预设的数据表白名单时,停止创建所述目标数据表的索引。
这里,索引创建策略是指创建索引专家知识(创建索引所要满足的条件或者规则),索引专家知识是预先制定好,并且可以定期维护, 例如,增加、修改和删除。这里的创建策略包括依据SQL语句、依据SQL语句和数据分布以及依据预先定义的规则。当然还可以使用其他索引创建策略,这里不做限定。
其中,当依据SQL语句创建索引而不需要分析数据分布时,则将所要操作的字段作为目标数据表的索引。例如,键值查询的SQL语句需要以WHERE条件字段建立索引。当依据SQL语句和数据分布创建索引时,需要考虑表数据分布,并根据具体的分布情况确定建立高效索引的方式。当依据预先定义的规则创建索引时,根据预先定义的规则判断是否需要建立索引。例如,根据应用的实际运行情况,禁止频繁插入数据的表创建索引。
其中,计算目标数据表中满足操作条件的表数据的分布情况的步骤具体包括:
读取预设的表数据扫描策略;
根据所述预设的扫描策略从所述目标数据表中获取满足所述操作条件的表数据;以及
根据预设的统计方法计算所述表数据的分布情况。
这里的扫描策略包括预定触发条件和/或扫描粒度等信息。触发条件可以包括定时扫描和新的SQL语句。根据设定触发条件,当新的SQL语句发生改变时,系统能够自动创建与之对应的索引,或者删除不再需要的索引。扫描粒度可以包括全部扫描和按照数据百分比采样。
在计算的表数据分布情况时,基于表的组成结构,分析数据在表中的分布情况。分析数据包括操作的字段、每个字段的数据的类型、每个字段的数据的分布以及数据的基数。数据的分布情况包括数据分成的列(所属字段)数,以及每列数据的最大、最小、平均、方差等统计信息。数据也可以离散分布。这里的读取、扫描和计算的步骤可以同时进行,以充分利用数据库的关系运算能力。对每个列数据计算出的结果均按数据表分类和保存。
索引创建策略需要根据数据分布的情况来判断是否满足预设的建立条件。当满足预设建立条件时,则可以进一步创建索引。通过以下 步骤,预设建立条件可以确保建立高效索引:
根据所述表数据的分布情况获取各个操作条件的筛选效率,按照所述筛选效率的从高到低的顺序将所述操作条件进行排序,并且根据排序后的操作条件建立复合索引;
用所述复合索引的先导创建单一索引;以及
判断所述复合索引的结果集和所述单一索引的结果集的占比是否大于预设阈值,其中,当所述复合索引的结果集和所述单一索引的结果集的占比大于预设阈值时,则将所述单一索引作为所述目标数据表的索引;当所述复合索引的结果集和所述单一索引的结果集的占比不大于预设阈值时,将所述复合索作为所述目标数据表的索引。
这里的复合索引是指包括多个操作条件的索引。复合索引的先导是指筛选效率最高的操作条件建立的单一索引。后面将以具体的实施例对上述索引建立的方式进行说明。在本发明中通过结合数据分布情况创建索引,可以使得SQL语句执行效率最高。
基于上述可知,在本发明所提供的自动创建索引的方法中,通过分析当前的SQL语句的组成结构,基于表数据在表中的分布情况,自动为SQL语句创建索引。与常规的人工分析预估创建索引的方法相比,本发明所提供的自动创建索引的方法的准确性更高,并且能够提高SQL语句执行效率。
下面结合具体的实施例对本发明自动创建索引的方法进行说明。以用户呼叫过程为例,信息记录在呼叫日志表中,需要对呼叫日志进行查询。如表1所示,用户呼叫日志表(calllog),其中,calllog的主要字段包括:流水号、主叫号码、被叫号码、开始时刻、结束时刻、详情等。
表1
字段 解释 类型 长度
fno 流水号 char 30
cno 主叫号码 char 13
cerno 被叫号码 char 13
sdate 开始时刻 date 8
edate 结束时刻 date 8
mdetails 详情 char 900
系统需要满足某个用户在某个时间段内的详情查询。例如,当系统根据主叫号码查询某天的呼叫日志表时,SQL语句如下:
select*from calllog where cno=’15800000000’
and sdate>=’2016-02-01 00:00:00’
and sdate<’2016-02-02 00:00:00’
将拆分SQL语句拆分成以下几个部分:
查询表名,包括:calllog;
WHERE条件部分,包括:
cno=’15800000000’
and sdate>=’2016-02-01 00:00:00’
and sdate<’2016-02-02 00:00:00’
GROUP BY分组部分为空;
ORDER BY排序部分为空;以及
返回字段列表,包括:*,代表所有字段。
分析SQL语句后,同时在两个字段上进行以下筛选:
对字段cno进行单值筛选,操作条件为cno等于15800000000;以及
对字段sdate进行范围筛选,操作条件为sdate在区间[2016-02-01 00:00:00,2016-02-02 00:00:00]。
接着,计算数据在表及其列上的分布。根据SQL分析结果,考虑主叫号码、开始时间两个字段。例如,计算结果如表2所示。
表2
Figure PCTCN2018074134-appb-000001
Figure PCTCN2018074134-appb-000002
在本实例中,基于SQL分析结果和数据分布结果,读取对应的策略。
策略一:在多个筛选条件情况下,筛选效率高的条件放在最前面,从而效率更高。
条件一的结果占比是0.0005%,筛选效率高,而条件二的结果占比是1.9%,筛选效率低。因此,字段在索引中的先后顺序是:cno、sdate。因此,考虑到所有筛选条件的索引为索引一,即calllog(cno,sdate)。
策略二:用复合索引的先导创建索引。但是用复合索引的先导创建的索引不可以与索引一同时存在。因此,可以创建一个索引二,即calllog(cno)
策略三:在通常情况下,筛选记录数结果集的占比大于预设阈值,这里大于15%。在这种情况下,筛选效率较低,因此不建议创建索引。
条件三与条件一的结果记录的个数之比=5/460=1.1%。经过比较,由于筛选效率小于15%,筛选效率高,所以索引一是建议的索引。索引二不可以与索引一同时存在。不建议使用索引二。经过分析,最终建议的索引是索引一,即calllog(cno,sdate)。
为了能使索引的增加和删除更加灵活,在当索引创建完成之后,本发明实施例所提供的自动创建索引的方法还包括:
实时监测数据查询语句和数据库中的数据表中的至少一者的是否发生变化,其中,当监测到数据查询语句和数据库中的数据表中的至少一者发生变化时,则根据变化情况进行建立索引操作和删除索引操作中的至少一种操作。
当监控到数据库的数据表中的数据发生变化,例如,数据的基数或者数据的分布等发生变化,重新计算表数据在表中的分布情况。计算方式可以采用增量计算,也可以采用全量计算。根据重新计算后的数据分布情况重新建立索引。
如图2所示,以执行INSERT语句的流程为例进行说明,该流程 包括以下步骤:
步骤S201,启动数据采集;
步骤S202,执行INSERT语句,其中,数据库应用程序将数据从数据源采集到数据集后,封装成INSERT语句,然后发送给数据库执行;在执行完成后,数据保存到数据库表中;
步骤S203,计算数据分布,其中,检测数据库中表数据的变化,重新计算数据在表中的分布指标;计算的方式可以配置策略,例如可以采用增量计算,也可以采用全量计算;计算结果将作为自动创建索引的依据;以及
步骤S204,结束。
图3示出执行新的SQL语句的流程的示意图。如图3所示,该方法主要包括以下步骤:
步骤S301,开始。
步骤S302,分析新的SQL语句需要的索引,其中,通过分析SQL语句中的WHERE筛选条件部分、GROUP BY分组部分和ORDER BY排序部分,获得创建索引的方式以使SQL语句效率最高;
步骤S303,基于表索引定义信息,判断是否存在对应的索引,其中,如果不存在对应的索引,则进行步骤S304以创建索引;如果存在对应的索引,则进行步骤S305而无需创建索引;
步骤S304,自动创建索引;
步骤S305,执行SQL语句,其中,数据库执行SQL语句,并且将计算结果返回给数据库应用程序。
步骤S306,结束。
基于上述可知,本发明当需要运行新的SQL语句发生改变,系统能自动创建与之对应的索引,删除不再需要的索引;当数据分布不一样和/或列中数据基数不一样时,本发明的自动创建索引的方法能够自动适应这种变化,删除不再适合的索引,创建有效索引。
本发明的一个实施例还提供了一种自动创建索引的装置。如图4所示,所述自动创建索引的装置包括:
分析单元41,用于分析数据查询语句中的目标数据表以及操作条件;
计算单元42,用于判断是否需要分析数据分布,其中,当判断需要分析数据分布时,所述计算单元42计算目标数据表中满足所述操作条件的表数据的分布情况;以及
创建单元43,用于当所述表数据的分布情况满足预设的索引创建策略时,用所述操作条件创建所述目标数据表的索引;或者当确定不需要分析所述数据分布时,直接用所述操作条件创建为所述目标数据表的索引。
其中,所述操作条件包括WHERE筛选语句、GROUP BY分组语句和ORDER BY排序语句中的任意一种或多种操作所对应的条件。
在一个示例性实施例中,分析单元41具体用于:
对数据查询语句进行语法检查,以判断所述数据查询语句是否为有效语句,其中
当判定所述数据查询语句为有效语句时,根据所述数据查询语句的语法规则获取所述目标数据表以及所述操作条件。
在一个示例性实施例中,计算单元42具体用于:
判断是否需要分析数据分布时,以获取索引创建策略的创建依据,根据所述创建依据判断所述目标数据表是否存在于预设的数据表白名单中,其中,
当所述目标数据表存在于预设的数据表白名单时,则根据所述创建依据判断是否需要分析数据分布,而当所述目标数据表不存在于预设的数据表白名单时,停止创建所述目标数据表的索引。
在一个示例性实施例中,计算单元42具体用于:
读取预设的表数据扫描策略;
根据所述扫描策略从所述目标数据表中获取满足所述操作条件的表数据;以及
利用预设的统计装置计算所述表数据的分布情况。
在一个示例性实施例中,创建单元43具体用于:
根据所述表数据的分布情况获取各个操作条件的筛选效率,按照 所述筛选效率的从高到低的顺序将所述操作条件进行排序,并且根据排序后的操作条件建立复合索引;
用所述复合索引的先导创建单一索引;以及
判断所述复合索引的结果集和单一索引的结果集的占比是否大于预设阈值,其中,当所述复合索引的结果集和所述单一索引的结果集的占比大于预设阈值时,则将所述单一索引作为所述目标数据表的索引;当所述复合索引的结果集和所述单一索引的结果集的占比不大于预设阈值时,将所述复合索作为所述目标数据表的索引。
在一个示例性实施例中,该装置还包括监测单元,用于:
在用所述操作条件创建所述目标数据表的索引之后,实时监测数据查询语句和数据库中的数据表中的至少一者数据查询语句和数据库中的数据表中的至少一者的变化发生变化,其中,当监测到数据查询语句和数据库中的数据表中的至少一者发生变化时,则根据变化情况进行建立索引操作和删除索引操作中的至少一种操作。
本发明还提供了一种数据库系统,该系统包括根据以上实施例的自动创建索引装置。该系统可以应用于数据发布模型和数据消费模型中。
图5为根据本发明提供的数据发布模型的结构示意图。在图5中,数据库应用程序作为发布者。数据发布模型包括以下部分:
发布者(数据库应用程序),构造成将数据从数据源采集到数据集中,并且发送给数据库系统;
数据库,构造成保存数据集,并且进行数据管理;以及
自动创建索引装置,构造成执行上述的自动创建索引方法。
对于该模型中各个部分的流程,可以参考上述图2中的步骤,这里不做进行说明。
图6为根据本发明提供的数据消费模型的结构示意图。在图6中,在数据库系统建立后,从数据源采集到系统的数据可以提供给应用程序使用。数据消费模型使用场景包括对数据库中的数据进行查询、修改和删除。该消费模型包括以下部分:
消费者(数据库应用程序),构造成将用户的数据使用请求转换为查询/修改/删除等SQL语句,将SQL语句发送给数据库系统执行,并返回结果;
自动创建索引装置:构造成获取所述SQL语句,其中,如果没有需要的索引,则自动创建索引并且同时监控数据库中数据的变化,其中,如果数据库中的数据发生变化,则重新计算数据在表中的分布;以及
数据库,构造成对保存的数据进行计算,并且将计算后的数据返回给应用程序。
对于该模型中各个部分的流程,可以参考上述图3中的步骤,这里不做进行说明。
本发明所提供的数据库系统可以优化数据库设计。对数据的操作包括存储和使用。在存储数据时,应用程序属于数据的发布者;而在使用数据时,应用程序属于数据的消费者。一般来说,发布者重点关注数据结构;而消费者更加关注索引。利用本发明的数据库系统,可以自动分析SQL语句的组成结构,并且基于表组成结构和数据在表中的分布情况,自动创建索引供SQL语句使用。消费者不再受限于系统建设初期固定的索引的局限性,使得数据库设计将更加合理。
本说明书中的各个实施例均采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似的部分互相参见即可。对于装置实施例而言,由于其与方法实施例基本相似,相关之处参见方法实施例的部分说明即可。并且,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个......”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。
另外,本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成, 所述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。
显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。

Claims (17)

  1. 一种自动创建索引的方法,包括:
    分析数据查询语句中的目标数据表以及操作条件;
    判断是否需要分析数据分布,其中,当判断需要分析数据分布时,计算所述目标数据表中满足所述操作条件的表数据的分布情况;以及
    当所述表数据的分布情况满足预设的索引创建策略时,用所述操作条件创建所述目标数据表的索引。
  2. 如权利要求1所述的方法,其中,分析数据查询语句中的目标数据表以及操作条件的步骤包括:
    对所述数据查询语句进行语法检查,以判断所述数据查询语句是否为有效语句,其中
    当判定所述数据查询语句为有效语句时,根据所述数据查询语句的语法规则获取所述目标数据表以及所述操作条件。
  3. 如权利要求1所述的方法,其中,判断是否需要分析数据分布的步骤包括:
    获取所述索引创建策略的创建依据,根据所述创建依据判断所述目标数据表是否存在于预设的数据表白名单中,其中
    当所述目标数据表存在于预设的数据表白名单时,则根据所述创建依据判断是否需要分析数据分布,当所述目标数据表不存在于预设的数据表白名单时,停止创建所述目标数据表的索引。
  4. 如权利要求1或3所述的方法,其中,计算所述目标数据表中满足所述操作条件的表数据的分布情况的步骤包括:
    读取预设的表数据扫描策略;
    根据所述预设的扫描策略从所述目标数据表中获取满足所述操作条件的表数据;以及
    根据预设的统计方法计算所述表数据的分布情况。
  5. 如权利要求1所述的方法,其中,当所述表数据的分布情况满足预设的索引创建策略时,用所述操作条件创建为所述目标数据表的索引的步骤包括:
    根据所述表数据的分布情况获取各个操作条件的筛选效率,按照筛选效率的从高到低的顺序将所述操作条件进行排序,并且根据排序后的所述操作条件建立复合索引;
    用所述复合索引的先导创建单一索引;以及
    判断所述复合索引的结果集和所述单一索引的结果集的占比是否大于预设阈值时,其中,当所述复合索引的结果集和所述单一索引的结果集的占比大于所述预设阈值时,则将所述单一索引作为所述目标数据表的索引;当所述复合索引的结果集和所述单一索引的结果集的占比不大于预设阈值时,将所述复合索作为所述目标数据表的索引。
  6. 如权利要求1所述的方法,其中,在用所述操作条件创建所述目标数据表的索引之后,所述方法还包括:
    实时监测数据查询语句和数据库中的数据表中的至少一者的是否发生变化,其中,当监测到数据查询语句和数据库中的数据表中的至少一者发生变化时,则根据变化情况进行建立索引操作和删除索引操作中的至少一种操作。
  7. 如权利要求1所述的方法,所述方法还包括:
    当判断不需要分析数据分布时,则直接用所述操作条件创建所述目标数据表的索引。
  8. 如权利要求1所述的方法,其特征在于,所述操作条件包括WHERE筛选语句、GROUP BY分组语句和ORDER BY排序语句中的任意一种或多种操作所对应的条件。
  9. 一种自动创建索引的装置,包括:
    分析单元,用于分析数据查询语句中的目标数据表以及操作条件;
    计算单元,用于判断是否需要分析数据分布,其中,当判断需要分析数据分布时,所述计算单元计算所述目标数据表中满足所述操作条件的表数据的分布情况;以及
    创建单元,用于当所述表数据的分布情况满足预设的索引创建策略时,用所述操作条件创建所述目标数据表的索引。
  10. 如权利要求9所述的装置,其中,所述分析单元还用于:
    对所述数据查询语句进行语法检查,以判断所述数据查询语句是否为有效语句;
    当判定所述数据查询语句为有效语句时,根据所述数据查询语句的语法规则获取所述目标数据表以及操作条件。
  11. 如权利要求9所述的装置,其中,所述计算单元还用于:
    判断是否需要分析数据分布时,以获取所述索引创建策略的创建依据,根据所述创建依据判断所述目标数据表是否存在于预设的数据表白名单中,其中
    当所述目标数据表存在于预设的数据表白名单时,则根据所述创建依据判断是否需要分析数据分布,当所述目标数据表不存在于预设的数据表白名单时,停止创建所述对所述目标数据表的索引。
  12. 如权利要求9或11所述的装置,其中,所述计算单元还用于:
    读取预设的表数据扫描策略;
    根据所述扫描策略从所述目标数据表中获取满足所述操作条件的表数据;以及
    利用预设的统计装置计算所述表数据的分布情况。
  13. 如权利要求9所述的装置,其中,所述创建单元还用于:
    根据所述表数据的分布情况获取各个操作条件的筛选效率,按照所述筛选效率的从高到低的顺序将所述操作条件进行排序,并且根据排序后的所述操作条件建立复合索引;
    用所述复合索引的先导创建单一索引;以及
    判断所述复合索引的结果集和所述单一索引的结果集的占比是否大于预设阈值时,其中,当所述复合索引的结果集和所述单一索引的结果集的占比大于所述预设阈值时,则将所述单一索引作为所述目标数据表的索引;当所述复合索引的结果集和所述单一索引的结果集的占比不大于预设阈值时,将所述复合索作为所述目标数据表的索引。
  14. 如权利要求9所述的装置,还包括监测单元,用于:
    在用所述操作条件创建为所述目标数据表的索引之后,实时监测数据查询语句和数据库中的数据表中的至少一者的是否发生变化,其中,当监测到数据查询语句和数据库中的数据表中的至少一者发生变化时,则根据变化情况进行建立索引操作和删除索引操作中的至少一种操作。
  15. 如权利要求9所述的装置,其中,所述创建单元还用于:
    当判断不需要分析数据分布时,则直接用所述操作条件创建所述目标数据表的索引。
  16. 如权利要求9所述的装置,其特征在于,所述操作条件包括WHERE筛选语句、GROUP BY分组语句、ORDER BY排序语句中的任意一种或多种操作所对应的条件。
  17. 一种数据库系统,包括权利要求9~16任一项所述的自动创建索引的装置。
PCT/CN2018/074134 2017-02-22 2018-01-25 一种自动创建索引的方法、装置及数据库系统 WO2018153210A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710094631.8 2017-02-22
CN201710094631.8A CN108460052B (zh) 2017-02-22 2017-02-22 一种自动创建索引的方法、装置及数据库系统

Publications (1)

Publication Number Publication Date
WO2018153210A1 true WO2018153210A1 (zh) 2018-08-30

Family

ID=63222126

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/074134 WO2018153210A1 (zh) 2017-02-22 2018-01-25 一种自动创建索引的方法、装置及数据库系统

Country Status (2)

Country Link
CN (1) CN108460052B (zh)
WO (1) WO2018153210A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110297825A (zh) * 2019-05-23 2019-10-01 中国平安人寿保险股份有限公司 数据处理方法、装置、计算机设备以及存储介质
CN110502513A (zh) * 2019-08-15 2019-11-26 中国平安财产保险股份有限公司 数据采集方法、装置、设备及计算机可读存储介质
CN114741419A (zh) * 2022-04-13 2022-07-12 福建天泉教育科技有限公司 一种统计数据的查询方法及终端

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110399377A (zh) * 2019-08-30 2019-11-01 北京东软望海科技有限公司 Sql的优化方法、装置、电子设备及计算机可读存储介质
CN110598445B (zh) * 2019-09-12 2022-05-20 金蝶蝶金云计算有限公司 一种数据库访问控制方法、系统及相关设备
CN114595242A (zh) * 2022-03-04 2022-06-07 北京字节跳动网络技术有限公司 一种数据操作方法、装置、计算机设备和存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040199530A1 (en) * 2001-04-19 2004-10-07 Microsoft Corporation Method and system for creating a database table index using multiple processors
CN104111955A (zh) * 2013-04-22 2014-10-22 中国银联股份有限公司 一种面向Hbase数据库的复合查询方法
CN105022743A (zh) * 2014-04-24 2015-11-04 中兴通讯股份有限公司 一种管理索引的方法及装置
CN105045851A (zh) * 2015-07-07 2015-11-11 福建天晴数码有限公司 根据日志分析自动创建数据库索引的方法及系统
CN105701098A (zh) * 2014-11-25 2016-06-22 国际商业机器公司 针对数据库中的表生成索引的方法和装置

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7895191B2 (en) * 2003-04-09 2011-02-22 International Business Machines Corporation Improving performance of database queries
GB2498556A (en) * 2012-01-20 2013-07-24 Data Re Ltd A method of querying a data structure
CN103810212B (zh) * 2012-11-14 2017-05-24 阿里巴巴集团控股有限公司 一种数据库索引的自动创建方法及系统
CN105095255A (zh) * 2014-05-07 2015-11-25 中兴通讯股份有限公司 一种数据索引创建方法及装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040199530A1 (en) * 2001-04-19 2004-10-07 Microsoft Corporation Method and system for creating a database table index using multiple processors
CN104111955A (zh) * 2013-04-22 2014-10-22 中国银联股份有限公司 一种面向Hbase数据库的复合查询方法
CN105022743A (zh) * 2014-04-24 2015-11-04 中兴通讯股份有限公司 一种管理索引的方法及装置
CN105701098A (zh) * 2014-11-25 2016-06-22 国际商业机器公司 针对数据库中的表生成索引的方法和装置
CN105045851A (zh) * 2015-07-07 2015-11-11 福建天晴数码有限公司 根据日志分析自动创建数据库索引的方法及系统

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110297825A (zh) * 2019-05-23 2019-10-01 中国平安人寿保险股份有限公司 数据处理方法、装置、计算机设备以及存储介质
CN110297825B (zh) * 2019-05-23 2024-06-11 中国平安人寿保险股份有限公司 数据处理方法、装置、计算机设备以及存储介质
CN110502513A (zh) * 2019-08-15 2019-11-26 中国平安财产保险股份有限公司 数据采集方法、装置、设备及计算机可读存储介质
CN114741419A (zh) * 2022-04-13 2022-07-12 福建天泉教育科技有限公司 一种统计数据的查询方法及终端

Also Published As

Publication number Publication date
CN108460052B (zh) 2022-11-01
CN108460052A (zh) 2018-08-28

Similar Documents

Publication Publication Date Title
WO2018153210A1 (zh) 一种自动创建索引的方法、装置及数据库系统
US11449506B2 (en) Recommendation model generation and use in a hybrid multi-cloud database environment
US8682875B2 (en) Database statistics for optimization of database queries containing user-defined functions
CN103390066B (zh) 一种数据库全局性自动化优化预警装置及其处理方法
US7797286B2 (en) System and method for externally providing database optimizer statistics
US9063973B2 (en) Method and apparatus for optimizing access path in database
US8533216B2 (en) Database system workload management method and system
US8712972B2 (en) Query optimization with awareness of limited resource usage
CN105320679B (zh) 一种数据表索引集合生成方法及装置
WO2009116028A2 (en) Method and apparatus for enhancing performance of database and environment thereof
US20090112792A1 (en) Generating Statistics for Optimizing Database Queries Containing User-Defined Functions
CN102063449A (zh) 提高数据库中数据对象统计信息可靠性的方法及装置
CN103136260A (zh) 评估过滤因子用于数据库中访问路径优化的方法和装置
US20150012498A1 (en) Creating an archival model
WO2023077823A1 (zh) 慢查询告警方法、电子设备及存储介质
CN105095255A (zh) 一种数据索引创建方法及装置
US11514236B1 (en) Indexing in a spreadsheet based data store using hybrid datatypes
US9158815B2 (en) Estimating a number of unique values in a list
US11500839B1 (en) Multi-table indexing in a spreadsheet based data store
US9367594B2 (en) Determining statistics for cost-based optimization of a workflow
JP2012512455A (ja) 自動的なデータストアアーキテクチャの検出
CN111221824A (zh) 存储空间的存储优化方法、装置、设备和介质
US20180181624A1 (en) Model-based generation of synthetical database statistics
CN116431306A (zh) 一种基于Spark任务中血缘信息的采集方法及装置
Barksten Evaluating the effect of cardinality estimates on two state-of-the-art query optimizer's selection of access method

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18756781

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18756781

Country of ref document: EP

Kind code of ref document: A1