Dynamic creation method and device for multi-dimensional index, equipment and medium

The dynamic creation of a multidimensional index using a target clustering model and machine learning enhances database query efficiency by adapting to changing query patterns and optimizing index management.

CN119127880APending Publication Date: 2024-12-13BEIJING YOUTEJIE INFORMATION TECH

Patent Information

Application Number
CN202411220527.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-02
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

Traditional static index strategies in database systems fail to adapt to complex and changing query patterns, requiring manual operations by administrators and leading to inefficient index management.

Method used

A method and device for dynamically creating a multidimensional index using a target clustering model to classify query patterns, generate a multidimensional composite index based on query clustering data, and adjust the index based on performance data, leveraging machine learning for automated index management.

Benefits of technology

The solution enables adaptive index management that accelerates and optimizes database queries, reducing labor costs by automatically creating and adjusting indexes to meet complex query needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119127880A_ABST
    Figure CN119127880A_ABST
Patent Text Reader

Abstract

The invention discloses a method, a device and equipment for dynamically creating a multi-dimensional index and a medium. The dynamic creation method of the multi-dimensional index comprises the following steps: acquiring a target clustering model; inputting a current query log of the database into the target clustering model to obtain query clustering data, and generating a multi-dimensional composite index based on the query clustering data; collecting index performance data of the multi-dimensional composite index, and adjusting the multi-dimensional composite index based on the index performance data. The technical scheme of the embodiment of the invention can adapt to a complex query scene of the database, and can automatically create and adjust the index, so that the labor cost is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of database query, and in particular to a method, device, equipment and medium for dynamically creating a multidimensional index. Background Art

[0002] In modern database systems, index creation and management are key technologies for optimizing query performance. However, traditional static index strategies cannot dynamically adjust indexes and cannot adapt to changing query patterns. They are often unable to cope with complex and changing query requirements. In addition, index creation and adjustment require manual operations by database administrators, which is inefficient. Summary of the invention

[0003] The present invention provides a method, device, equipment and medium for dynamically creating a multidimensional index to solve the problem that the existing database index strategy cannot adapt to complex query scenarios and the index management efficiency is low.

[0004] According to one aspect of the present invention, a method for dynamically creating a multidimensional index is provided, comprising:

[0005] Obtaining a target clustering model; wherein the target clustering model is used to classify query patterns of database query logs;

[0006] Input the current query log of the database into the target clustering model to obtain query clustering data, and generate a multi-dimensional composite index based on the query clustering data;

[0007] Collect index performance data of the multidimensional composite index and adjust the multidimensional composite index based on the index performance data.

[0008] According to another aspect of the present invention, there is provided a device for dynamically creating a multidimensional index, comprising:

[0009] A model acquisition module is used to acquire a target clustering model; wherein the target clustering model is used to classify query patterns of database query logs;

[0010] A multidimensional composite index generation module is used to input the current query log of the database into the target clustering model to obtain query clustering data, and generate a multidimensional composite index based on the query clustering data;

[0011] The multidimensional composite index adjustment module is used to collect index performance data of the multidimensional composite index and adjust the multidimensional composite index based on the index performance data.

[0012] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0013] at least one processor; and

[0014] a memory communicatively connected to the at least one processor; wherein,

[0015] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method for dynamically creating a multidimensional index described in any embodiment of the present invention.

[0016] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the method for dynamically creating a multidimensional index as described in any embodiment of the present invention when executed.

[0017] The technical solution of the embodiment of the present invention obtains the target clustering model, thereby inputting the current query log of the database into the target clustering model to obtain query clustering data, and generates a multidimensional composite index based on the query clustering data, and then collects the index performance data of the multidimensional composite index, and adjusts the multidimensional composite index based on the index performance data. In this solution, the target clustering model can perform data clustering analysis on the current query log of the database to obtain query clustering data that can be used for index recommendation, and the multidimensional composite index generated based on the query clustering data can take into account multiple fields to meet the complex query needs of the multidimensional database, and continuously optimize the recommended index by adjusting the multidimensional composite index, thereby realizing accelerated and accurate query of the database, solving the problem that the existing database index strategy cannot adapt to complex query scenarios and the index management efficiency is low, can adapt to the complex query scenarios of the database, and can automatically create and adjust the index, reducing labor costs.

[0018] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0020] Figure 1 A flowchart of a method for dynamically creating a multidimensional index provided in the first embodiment of the present invention;

[0021] Figure 2 A flowchart of a method for dynamically creating a multidimensional index provided in Embodiment 2 of the present invention;

[0022] Figure 3 A schematic diagram of the structure of a device for dynamically creating a multidimensional index provided in Embodiment 3 of the present invention;

[0023] Figure 4 A schematic diagram of the structure of an electronic device that can be used to implement an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0024] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0025] It should be noted that the term "target" and the like in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0026] Embodiment 1

[0027] Figure 1 This is a flowchart of a method for dynamically creating a multidimensional index provided in the first embodiment of the present invention. This embodiment can be applied to dynamically adjust the index conditions required for database search. The method can be executed by a dynamic creation device for a multidimensional index. The dynamic creation device for a multidimensional index can be implemented in the form of hardware and / or software. The dynamic creation device for a multidimensional index can be configured in an electronic device. Figure 1 As shown, the method includes:

[0028] Step 110: Obtain a target clustering model.

[0029] Among them, the target clustering model can be a model that can classify database query patterns. The target clustering model can be used to classify query patterns of database query logs. The query pattern can be understood as the clustering of database query logs by the target clustering model based on query requirements. Exemplarily, the number of clusters determined by the target clustering model is equal to the number of database query patterns, and each cluster can be used as a database query pattern.

[0030] In an embodiment of the present invention, a trained machine learning model capable of database query pattern analysis may be used as a target clustering model.

[0031] Step 120: Input the current query log of the database into the target clustering model to obtain query clustering data, and generate a multi-dimensional composite index based on the query clustering data.

[0032] Among them, the current query log of the database can be a query log associated with the current query statement of the database. The query clustering data can be data obtained by clustering the current query log of the database by the target clustering model. The query clustering data can include the table name of the current cluster and the key fields associated with the table name. Exemplarily, the table name of the current cluster can be products, and the key fields associated with products are price, category. It should be noted that a cluster in the query clustering data can include at least one table name and the key fields associated with the table name.

[0033] The multidimensional composite index may be a multidimensional index determined by querying fields in the clustered data. Each multidimensional composite index may be used to search a table in a database, and the number of index fields of each multidimensional composite index is at least two.

[0034] In an embodiment of the present invention, the current query log of the database can be input into the target clustering model, and then the current query log of the database can be clustered through the target clustering model to obtain query clustering data, and then the query clustering data can be combined according to the relationship between the query field and the query table in the current query log of the database to obtain a multi-dimensional composite index.

[0035] Step 130: Collect index performance data of the multidimensional composite index, and adjust the multidimensional composite index based on the index performance data.

[0036] The index performance data may be data describing the search performance of a multi-dimensional composite index, and may include but is not limited to search execution time and return result validity.

[0037] In an embodiment of the present invention, database search operations of a multidimensional composite index are monitored, and index performance data matching the multidimensional composite index is collected, so that addition, deletion, and modification operations are performed on the multidimensional composite index based on the index performance data to improve the search effect of the multidimensional composite index.

[0038] Optionally, the database query log can be stored in memory 1, the query clustering data can be stored in memory 2, and the index information of the added, deleted and modified multidimensional composite index can be stored in memory 2, and then the data in memory 1 and memory 2 can be used to train a model for automatically adjusting the multidimensional index, so that the generated multidimensional composite index can be automatically adjusted using the model.

[0039] Exemplarily, detailed information of the database query log (query statement, query time, and return result size, etc.) is recorded in the memory 1.

[0040] The technical solution of the embodiment of the present invention obtains the target clustering model, thereby inputting the current query log of the database into the target clustering model to obtain query clustering data, and generates a multidimensional composite index based on the query clustering data, and then collects the index performance data of the multidimensional composite index, and adjusts the multidimensional composite index based on the index performance data. In this solution, the target clustering model can perform data clustering analysis on the current query log of the database to obtain query clustering data that can be used for index recommendation, and the multidimensional composite index generated based on the query clustering data can take into account multiple fields to meet the complex query needs of the multidimensional database, and continuously optimize the recommended index by adjusting the multidimensional composite index, thereby realizing accelerated and accurate query of the database, solving the problem that the existing database index strategy cannot adapt to complex query scenarios and the index management efficiency is low, can adapt to the complex query scenarios of the database, and can automatically create and adjust the index, reducing labor costs.

[0041] Embodiment 2

[0042] Figure 2 This is a flowchart of a method for dynamically creating a multidimensional index provided in the second embodiment of the present invention. This embodiment is specific based on the above embodiment and provides a specific optional implementation method for obtaining a target clustering model. Figure 2 As shown, the method includes:

[0043] Step 210: Collect database historical query logs and perform data preprocessing on the database historical query logs to obtain target sample data.

[0044] The database historical query log may be a query log associated with a database historical query statement, and the target sample data may be data obtained by preprocessing the database historical query log.

[0045] In the embodiment of the present invention, the query operation of the database can be monitored, the historical query log of the database can be obtained, and the historical query log of the database can be preprocessed according to the preset data preprocessing rules to obtain the target sample data.

[0046] In an optional embodiment of the present invention, data preprocessing is performed on the database historical query log to obtain target sample data, which may include: cleaning the database historical query log to obtain data to be identified; extracting model training feature data from the data to be identified, and using the model training feature data as target sample data.

[0047] The data to be identified can be the data obtained after the data cleaning of the historical query log of the database is completed. The model training feature data can be the feature vector converted from the data to be identified by the machine learning model.

[0048] In an embodiment of the present invention, the historical query logs of the database can be cleaned to remove invalid data (query logs with incorrect formats and missing values, etc.) to obtain data to be identified as features, and then feature extraction is performed on the data to be identified as features, that is, the data to be identified as features is converted into a structured data structure that can be processed by a machine learning model to obtain model training feature data, and the model training feature data is further used as target sample data.

[0049] In an optional embodiment of the present invention, extracting model training feature data from the data to be feature identified may include: extracting target query fields, query conditions, and query execution time from the data to be feature identified; vectorizing the target query fields, query conditions, and query execution time to obtain model training feature data.

[0050] The target query field may be a field that the user needs to query. The query execution time may be the time from when the query operation corresponding to the current query log of the database starts to be executed to when the query result is obtained.

[0051] In an embodiment of the present invention, the target query field, query conditions and query execution time in the data to be feature identified can be parsed, and then the target query field, query conditions and query execution time are formatted, i.e., vectorized, to obtain model training feature data.

[0052] Step 220: Determine a target clustering model based on the target sample data and the clustering model to be trained.

[0053] The clustering model to be trained may be a machine learning model with data clustering capability. Exemplarily, the clustering model to be trained may be a K-means model.

[0054] In the embodiment of the present invention, the target sample data may be used to train the clustering model to be trained, and the trained model may be used as the target clustering model.

[0055] Optionally, when the K-means model is used as the clustering model to be trained, the value of K can be set as needed to control the number of query pattern classifications generated by the target clustering model.

[0056] Step 230: Input the current query log of the database into the target clustering model to obtain query clustering data, and generate a multi-dimensional composite index based on the query clustering data.

[0057] In an optional embodiment of the present invention, generating a multidimensional composite index based on query clustering data may include: parsing the query clustering data to determine the current query pattern associated data; determining the index recommendation fields based on the current query pattern associated data, and generating a multidimensional composite index matching the current query pattern based on the index recommendation fields.

[0058] The current query pattern associated data may be a clustering result determined by the current query log of the database. The current query pattern associated data includes the table name included in the current clustering and the key fields associated with the table name. The current query pattern may be the query pattern corresponding to the current query pattern associated data, that is, the clustering result corresponding to the current query pattern associated data.

[0059] In an embodiment of the present invention, query clustering data can be parsed and a clustering result can be selected as the current query pattern associated data, so as to determine the field corresponding to the table name in the current query pattern associated data, and use the determined field as the index recommendation field, and further combine the index recommendation fields associated with the same table name to obtain a multidimensional composite index that matches the current query pattern.

[0060] Step 240: Collect index performance data of the multidimensional composite index, and adjust the multidimensional composite index based on the index performance data.

[0061] In an optional embodiment of the present invention, adjusting a multidimensional composite index based on index performance data may include: determining a validity score of the multidimensional composite index based on the index performance data; and determining and deleting invalid composite indexes based on the validity score of the multidimensional composite index and an index retention score threshold.

[0062] The validity score may be a score for the validity of the multi-dimensional composite index search. The index retention score threshold may be a preset score value. An invalid composite index may be a multi-dimensional composite index that does not meet the search performance requirements.

[0063] In an embodiment of the present invention, scores can be pre-set for different index performances, so that based on the index performance data of the multidimensional composite index, the corresponding scores are queried to obtain the validity score of the multidimensional composite index, and then the validity score of the multidimensional composite index is compared with the index retention score threshold. The multidimensional composite index with a validity score lower than the index retention score threshold is treated as an invalid composite index, and the invalid composite index is deleted.

[0064] In an optional embodiment of the present invention, after adjusting the multidimensional composite index based on the index performance data, the method may further include: obtaining target database table structure information; and querying the target database according to the adjusted multidimensional composite index and the database table structure information.

[0065] The target database table structure information may be the table structure information of the database that the user needs to query. The target database may be the database that the user needs to query.

[0066] In the embodiment of the present invention, the target database table structure information can be obtained, so that the target database can be queried using the adjusted multi-dimensional composite index according to the database table structure information.

[0067] In a specific example, assume that the database history query log is: [

[0069] {'query':"SELECT*FROM users WHERE age>30AND name='John'",

[0070] 'execution_time':0.45,'result_size':200},

[0071] {'query':"SELECT*FROM orders WHERE amount>100AND date='2023-01-01'",

[0072] 'execution_time':0.7,'result_size':150},

[0073] {'query':"SELECT*FROM products WHERE price<50AND category='books'",

[0074] 'execution_time':0.6,'result_size':300} ]

[0076] After cleaning and converting the database historical query logs, the model training feature data is obtained as follows: [('age','users'),('name','users'),0.45,200]

[0077] [('amount','orders'),('date','orders'),0.7,150]

[0078] [('price','products'),('category','products'),0.6,300]

[0079] The K-means clustering model is used as the clustering model to be trained, and the number of clusters is set to 2. The trained model can distinguish different query requirements based on field combinations, execution time, and result size. The model identifies the following two query patterns, namely the following two clusters: Cluster 1: For queries involving the user table and the product table, it is recommended to create indexes on the users(age,name) and products(price,category) fields. Cluster 2: For queries involving the order table, it is recommended to create an index on the orders(amount,date) field.

[0080] The K-means clustering model will try to divide the data into two groups based on these feature vectors. The goal is to minimize the differences between the data points in each group (that is, the feature vector differences between the data points in the same group are minimized), while maximizing the differences between the data points in different groups. The specific steps are: Randomly select two data points as the initial cluster centers. For each data point, calculate its distance to each cluster center (based on the model training feature data). Assign the data point to the cluster center that is closest to it. Recalculate the center point of each cluster (average model training feature data) to update the cluster center, and return to perform the operation of calculating the distance from each data point to each cluster center (based on the feature vector) until the cluster center no longer changes or changes very little.

[0081] For the user table (users), create a multidimensional composite index based on the age and name fields. For the order table (orders), create a multidimensional composite index based on the amount and date fields. For the product table (products), create a multidimensional composite index based on the price and category fields.

[0082] This solution can realize intelligent index management through automated monitoring, data collection and machine learning analysis, dynamically create and adjust multidimensional indexes, adapt to changing query patterns, ensure continuous optimization of query performance, identify query patterns and field combinations that most need optimization, and improve the effectiveness of index creation and query efficiency.

[0083] The technical solution of the embodiment of the present invention collects historical query logs of the database and performs data preprocessing on the historical query logs of the database to obtain target sample data, thereby determining the target clustering model according to the target sample data and the clustering model to be trained, and then inputting the current query log of the database into the target clustering model to obtain query clustering data, and generating a multidimensional composite index based on the query clustering data, further collecting index performance data of the multidimensional composite index, and adjusting the multidimensional composite index based on the index performance data. In this solution, the target clustering model can perform data clustering analysis on the current query log of the database to obtain query clustering data that can be used for index recommendation, and the multidimensional composite index generated based on the query clustering data can take into account multiple fields to meet the complex query needs of the multidimensional database, and continuously optimize the recommended index by adjusting the multidimensional composite index, thereby realizing accelerated and accurate query of the database, solving the problem that the existing database index strategy cannot adapt to complex query scenarios and the index management efficiency is low, can adapt to the complex query scenarios of the database, and can automatically create and adjust the index, reducing labor costs.

[0084] Embodiment 3

[0085] Figure 3 This is a schematic diagram of a structure of a device for dynamically creating a multidimensional index provided by Embodiment 3 of the present invention. Figure 3 As shown, the device comprises:

[0086] The model acquisition module 310 is used to acquire a target clustering model; wherein the target clustering model is used to classify query patterns of database query logs;

[0087] The multidimensional composite index generation module 320 is used to input the current query log of the database into the target clustering model to obtain query clustering data, and generate a multidimensional composite index based on the query clustering data;

[0088] The multidimensional composite index adjustment module 330 is used to collect index performance data of the multidimensional composite index and adjust the multidimensional composite index based on the index performance data.

[0089] The technical solution of the embodiment of the present invention obtains the target clustering model, thereby inputting the current query log of the database into the target clustering model to obtain query clustering data, and generates a multidimensional composite index based on the query clustering data, and then collects the index performance data of the multidimensional composite index, and adjusts the multidimensional composite index based on the index performance data. In this solution, the target clustering model can perform data clustering analysis on the current query log of the database to obtain query clustering data that can be used for index recommendation, and the multidimensional composite index generated based on the query clustering data can take into account multiple fields to meet the complex query needs of the multidimensional database, and continuously optimize the recommended index by adjusting the multidimensional composite index, thereby realizing accelerated and accurate query of the database, solving the problem that the existing database index strategy cannot adapt to complex query scenarios and the index management efficiency is low, can adapt to the complex query scenarios of the database, and can automatically create and adjust the index, reducing labor costs.

[0090] Optionally, the model acquisition module 310 is specifically used to collect database historical query logs and perform data preprocessing on the database historical query logs to obtain target sample data; and determine the target clustering model based on the target sample data and the clustering model to be trained.

[0091] Optionally, the model acquisition module 310 is specifically used to clean the database historical query log to obtain the data to be feature-recognized; extract the model training feature data in the data to be feature-recognized, and use the model training feature data as the target sample data.

[0092] Optionally, the model acquisition module 310 is specifically used to extract the target query field, query conditions and query execution time in the data to be feature identified; vectorize the target query field, the query conditions and the query execution time to obtain the model training feature data.

[0093] Optionally, the multidimensional composite index generation module 320 is specifically used to parse the query clustering data and determine the current query pattern related data; based on the current query pattern related data, determine the index recommendation field, and generate the multidimensional composite index matching the current query pattern according to the index recommendation field.

[0094] Optionally, the multidimensional composite index adjustment module 330 is specifically used to determine the validity score of the multidimensional composite index based on the index performance data; determine and delete invalid composite indexes according to the validity score of the multidimensional composite index and the index retention score threshold.

[0095] Optionally, the dynamic creation device of the multidimensional index further includes a database query module, which is used to obtain the table structure information of the target database; and query the target database according to the adjusted multidimensional composite index and the database table structure information.

[0096] The device for dynamically creating a multidimensional index provided in the embodiment of the present invention can execute the method for dynamically creating a multidimensional index provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0097] Embodiment 4

[0098] Figure 4 A schematic diagram of an electronic device that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0099] like Figure 4 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0100] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0101] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a dynamic creation method of a multidimensional index.

[0102] In some embodiments, the dynamic creation method of a multidimensional index may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the dynamic creation method of the multidimensional index described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the dynamic creation method of the multidimensional index in any other appropriate manner (e.g., by means of firmware).

[0103] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0104] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0105] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0106] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0107] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0108] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0109] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0110] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for dynamically creating a multidimensional index, characterized in that: include: Obtaining a target clustering model; wherein the target clustering model is used to classify query patterns of database query logs; Inputting the current query log of the database into the target clustering model to obtain query clustering data, and generating a multi-dimensional composite index based on the query clustering data; Index performance data of the multidimensional composite index is collected, and the multidimensional composite index is adjusted based on the index performance data.

2. The method according to claim 1, characterized in that The obtaining of the target clustering model comprises: Collecting database historical query logs and performing data preprocessing on the database historical query logs to obtain target sample data; The target clustering model is determined according to the target sample data and the clustering model to be trained.

3. The method according to claim 2, characterized in that The data preprocessing of the database historical query log to obtain target sample data includes: Clean the historical query log of the database to obtain data to be identified by features; Model training feature data is extracted from the data to be feature-recognized, and the model training feature data is used as the target sample data.

4. The method according to claim 3, characterized in that The extracting the model training feature data from the data to be feature identified includes: Extracting target query fields, query conditions, and query execution time from the data to be feature-recognized; The target query field, the query condition, and the query execution time are vectorized to obtain the model training feature data.

5. The method according to claim 1, characterized in that The generating a multi-dimensional composite index based on the query cluster data includes: Parsing the query clustering data to determine current query pattern associated data; Based on the current query mode associated data, the index recommendation fields are determined, and the multi-dimensional composite index matching the current query mode is generated according to the index recommendation fields.

6. The method according to claim 1, characterized in that The adjusting the multi-dimensional composite index based on the index performance data includes: Determining a validity score of the multi-dimensional composite index based on the index performance data; According to the validity score of the multi-dimensional composite index and the index retention score threshold, an invalid composite index is determined and deleted.

7. The method according to claim 6, characterized in that After adjusting the multi-dimensional composite index based on the index performance data, the method further includes: Get the target database table structure information; The target database is queried according to the adjusted multi-dimensional composite index and the database table structure information.

8. A device for dynamically creating a multidimensional index, characterized in that: include: A model acquisition module, used to acquire a target clustering model; wherein the target clustering model is used to classify query patterns of database query logs; A multidimensional composite index generation module, used for inputting the current query log of the database into the target clustering model to obtain query clustering data, and generating a multidimensional composite index based on the query clustering data; The multidimensional composite index adjustment module is used to collect index performance data of the multidimensional composite index and adjust the multidimensional composite index based on the index performance data.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method for dynamically creating a multidimensional index according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the method for dynamically creating a multidimensional index according to any one of claims 1 to 7 when executed.

Citation Information

Patent Citations

  • Index management method, device, storage medium and equipment used for log query

    CN107220287A

  • Cloud database secondary index automatic recommendation method and system based on slow query log

    CN114064689A

  • Index optimization method, device and equipment and computer readable storage medium

    CN114968972A

  • Log data storage method and device, log data query method and device, equipment and medium

    CN116894021A

  • Automated database index management

    US20210349874A1

Cited By

  • Data query method and device, electronic equipment and computer readable storage medium

    CN121350312A