Data query method and device, equipment and storage medium

By using the query matching model to filter out the most suitable target database for data query, the problems of long response time and low query efficiency in the prior art are solved, and the rapid response of data queries and continuous operation of business systems are achieved.

CN119493810APending Publication Date: 2025-02-21KE COM (BEIJING) TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411604020.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-11
Publication Date
2025-02-21

AI Technical Summary

Technical Problem

The prior art has a long response time during data query and low query efficiency. When adding new databases to the business system, it may be necessary to redesign the query logic, affecting the continuity of the business system.

Method used

By obtaining the query characteristics of the data query request and the database characteristics of the candidate database, using the query matching model to perform query matching, the target database is determined from the candidate database, and the target database is automatically called for data query.

Benefits of technology

It improves data query efficiency, ensures continuous operation of business systems, and reduces the complexity of system update operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119493810A_ABST
    Figure CN119493810A_ABST
Patent Text Reader

Abstract

The invention provides a data query method and device, equipment and a storage medium, and the method comprises the steps: obtaining query features of a data query request and database features of a candidate database, inputting the query features and the database features into a query matching model, screening out a target database matched with the data query request through the query matching model, and storing the target database in the candidate database. A proper query mode is evaluated based on the data resource condition of each candidate database through the query matching model, and the screened target database is automatically called to perform data query, so that the quick response of the data query result is realized, and the data query efficiency can be improved; moreover, when a new database is added into the business system, the data query logic does not need to be redesigned and adjusted, so that the system updating operation is reduced, and the continuous operation of the business system can be ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to database technology, and in particular to a data query method, device, equipment and storage medium. Background Art

[0002] With the development of the Internet, the business of various enterprises is gradually moving online. Thousands of business data are generated and stored in databases every month. In order to meet various data storage needs, data is usually stored in the form of relational databases (MySQL) and sharded libraries and tables to improve database performance. When data in MySQL is updated, the data update event will be sent to the corresponding sharded library for synchronous update.

[0003] The storage format of sub-libraries and sub-tables allows business data to be stored in multiple sub-libraries or sub-tables, but different databases and data tables have different data storage characteristics and data query methods, so technical personnel are required to design data query logic to meet users' complex query needs. However, under the query logic of the existing technology, the response time of data query is long and the query efficiency is low. In addition, when a new sub-library is added to the business system, the query logic may need to be redesigned, which affects the continuity of the business system operation. Summary of the invention

[0004] The embodiments of the present disclosure provide a data query method, apparatus, device and storage medium, which can improve data query efficiency and ensure the continuous operation of a business system.

[0005] One aspect of an embodiment of the present disclosure provides a data query method, including:

[0006] In response to a data query request, obtaining a query feature based on the data query request, the query feature including at least one of a query mode, a query condition, a query data type, and a query data amount;

[0007] Acquire database characteristics of each candidate database, wherein the database characteristics include at least one of a storage data volume, a database index parameter, and a data dispersion degree;

[0008] Using a query matching model, query matching is performed based on the query characteristics and the database characteristics of each candidate database, and a target database is determined from the candidate databases, wherein the target database has a response speed to the data query request greater than the response speeds of other candidate databases to the data query request;

[0009] Based on the data query request, the target database is called to perform data query and obtain data query results.

[0010] Optionally, the method further includes:

[0011] Building a training data set based on sample query features and sample database features corresponding to each sample database;

[0012] The initial model is trained using the training data set until a preset training condition is met to obtain the query matching model.

[0013] Optionally, the performing model training on the initial model using the training data set includes:

[0014] Inputting the sample query feature and the sample database feature into the initial model to obtain a model prediction result output by the initial model;

[0015] Calculating the loss function value of the initial model based on the model prediction result and the sample label corresponding to the sample query feature using a loss function, wherein the sample label is used to indicate a sample database matching the sample query feature;

[0016] The initial function is back-propagated based on the loss function value to update the model parameters.

[0017] Optionally, acquiring the query feature based on the data query request includes:

[0018] Parsing the query request to obtain a query text in the query request, where the query text is obtained based on a data query operation of a user;

[0019] The language model is used to perform intent recognition on the query text to obtain the query features.

[0020] Optionally, calling the target database to perform data query based on the data query request to obtain the data query result includes:

[0021] Using the query matching model, generating a query statement matching the target database based on the query features;

[0022] The database client corresponding to the target database is called, and the query statement is sent to the server of the target database through the database client to obtain the data query result.

[0023] Optionally, the candidate database is used to synchronously store business data in a relational database;

[0024] The method further comprises:

[0025] Parsing a database log of a relational database by a log parsing tool to obtain a data update message, wherein the database log records the data update instruction received by the relational database;

[0026] The candidate database is synchronously updated with data based on the data update message.

[0027] Optionally, the synchronously updating the data of the candidate database based on the data update message includes:

[0028] The data update message is sent to the message middleware, wherein the access configuration management layer of the candidate database is used to subscribe to the data update message of the message middleware and perform data synchronization update based on the data update message.

[0029] Another aspect of the present disclosure provides a data query device, including:

[0030] A first acquisition module, configured to respond to a data query request and acquire a query feature based on the data query request, wherein the query feature includes at least one of a query mode, a query condition, a query data type, and a query data volume;

[0031] A second acquisition module, used to acquire database characteristics of each candidate database, wherein the database characteristics are used to indicate at least one of the amount of stored data, the index structure, and the degree of data dispersion;

[0032] A determination module, configured to use a query matching model to perform query matching based on the query characteristics and the database characteristics of each candidate database, and determine a target database from the candidate databases, wherein the target database has a response speed to the data query request greater than the response speeds of other candidate databases to the data query request;

[0033] The query module is used to call the target database to perform data query based on the data query request and obtain data query results.

[0034] Another aspect of the present disclosure provides an electronic device, including:

[0035] Memory for storing computer programs;

[0036] The processor is used to execute the computer program stored in the memory, and when the computer program is executed, the method described in the above aspects is implemented.

[0037] Another aspect of the embodiments of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method described in the above aspects is implemented.

[0038] Another aspect of the embodiments of the present disclosure provides a computer program, including computer program instructions, which implement the methods described in the above aspects when executed by a processor.

[0039] Based on the embodiments of the present disclosure, by obtaining query features of a data query request and database features of a candidate database, the query features and database features are input into a query matching model, and the query matching model is used to screen out a target database that matches the data query request. The query matching model evaluates a suitable query method based on the data resource status of each candidate database, and automatically calls the screened target database for data query, thereby achieving a rapid response to data query results and improving data query efficiency. Furthermore, when a new database is added to a business system, there is no need to redesign and adjust the data query logic, which reduces system update operations and can ensure the continuous operation of the business system.

[0040] The technical solution of the present disclosure is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] The accompanying drawings, which constitute a part of the specification, illustrate embodiments of the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0042] The present disclosure may be more clearly understood from the following detailed description with reference to the accompanying drawings, in which:

[0043] Figure 1 A flowchart of an embodiment of the data query method disclosed herein;

[0044] Figure 2 A flowchart of another embodiment of the data query method disclosed herein;

[0045] Figure 3 A flowchart of another embodiment of the data query method disclosed herein;

[0046] Figure 4 This is a structural block diagram of an embodiment of the chip data query device disclosed in the present invention;

[0047] Figure 5 This is a structural block diagram of another embodiment of the chip data query device disclosed in the present invention;

[0048] Figure 6 The figure is a schematic diagram of the structure of an application embodiment of the electronic device disclosed in the present invention. DETAILED DESCRIPTION

[0049] Various exemplary embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings. It should be noted that the relative arrangement of components and steps, numerical expressions and numerical values ​​set forth in these embodiments do not limit the scope of the present disclosure unless otherwise specifically stated.

[0050] Those skilled in the art can understand that the terms "first" and "second" in the embodiments of the present disclosure are only used to distinguish different steps, devices or modules, etc., and neither represent any specific technical meaning nor indicate the necessary logical order between them.

[0051] It should also be understood that in the embodiments of the present disclosure, “plurality” may refer to two or more than two, and “at least one” may refer to one, two, or more than two.

[0052] It should also be understood that any component, data or structure mentioned in the embodiments of the present disclosure can generally be understood as one or more, unless explicitly limited or otherwise indicated in the context.

[0053] In addition, the term "and / or" in the present disclosure is only a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in the present disclosure generally indicates that the associated objects before and after are in an "or" relationship.

[0054] It should also be understood that the description of the various embodiments in the present disclosure focuses on the differences between the various embodiments, and the same or similar aspects thereof can be referenced to each other, and for the sake of brevity, they will not be described one by one.

[0055] At the same time, it should be understood that for the convenience of description, the sizes of the various parts shown in the drawings are not drawn according to the actual proportional relationship.

[0056] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the present disclosure, its application, or uses.

[0057] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be considered as part of the specification.

[0058] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.

[0059] Please refer to Figure 1 , which shows a flow chart of a data query method provided by an exemplary embodiment of the present disclosure. The data query method of the embodiment of the present disclosure can be implemented by a database system. The method includes the following steps:

[0060] Step 101: In response to a data query request, a query feature is obtained based on the data query request.

[0061] The query characteristics may include, but are not limited to, at least one of a query method, a query condition, a query data type, and a query data volume.

[0062] In a possible implementation, the user may input data query text using the operating system or client in the user device to enable the user device to generate a data query request. The query feature may be obtained by parsing the data query text included in the data query request sent by the user device.

[0063] Query features can reflect the characteristics of the current data query task. For example, the query method can indicate the method or approach of extracting target data from the data stored in the database, such as full-text search, range query or aggregate query; the query condition can be the rules or standards used to screen and filter data, such as field name, time limit condition, quantity limit condition, etc.; the query data type can indicate the data type of the expected return value (i.e., query result), such as sales volume, product name, sales volume, etc.; the query data volume can indicate the data volume of the expected return value (i.e., query result), such as 100 pieces of data, data collected within 24 hours, etc.

[0064] Optionally, a neural network model with text recognition function can be used to recognize the text content input by the user in the data query request to extract query features. For example, based on the text content "top 100 products with the highest sales volume" in the data query request, it can be extracted that the query method is full-text search, the query conditions include "sales volume", "top 100" and "product name", the query data type is "product name" and the query data volume is "100 data".

[0065] Step 102: Obtain database features of each candidate database.

[0066] The database characteristics may include, for example, but are not limited to, at least one of the amount of stored data, database index parameters, and data discreteness.

[0067] In a possible implementation, the database system of the disclosed embodiment uses multiple databases to store business data, and there may be data overlap between the databases, that is, the same data may be stored in multiple databases at the same time. For example, the consumption behavior data of a user who purchases a certain commodity can be stored in both the user database and the commodity database, and different types of databases have different data storage structures, different data storage formats, different data volumes, and different query statements. Therefore, it is necessary to screen out the database that is most suitable for the above-mentioned data query request, that is, the target database, from the candidate database for data query to improve data query efficiency. After receiving the data query request, the database features of each candidate database can be extracted through the database interface of each candidate database. The candidate database can be all the databases in the database system, or it can be a database related to the data to be queried indicated by the above-mentioned data query request obtained by pre-screening all the databases in the database system.

[0068] Database characteristics can reflect the data storage characteristics of the corresponding candidate database. For example, the amount of stored data can include information such as the number of documents and the number of rows in the table, which can reflect the amount of data stored in the candidate database. For full-text search queries, the smaller the amount of data, the faster the query results are obtained; database index parameters can be used to indicate information such as the depth of the index and the size of the index. The depth of the index will affect the number of times the table is returned during data query, and the size of the index will also affect the length of time for retrieval and positioning; the degree of data dispersion can include the frequency of occurrence of various terms, the difference in values ​​in the same field (such as variance, standard deviation), etc. Generally, the lower the degree of data dispersion, the higher the query performance of the database.

[0069] Optionally, the database type of the candidate database may include, but is not limited to, MySQL database, Elasticsearch (ES) database, Mongo database (MongoDB), etc. For different types of candidate databases, the specific dimensions of their database characteristics may be different. For example, for a MySQL database, the number of rows in a data table, the cardinality of an index, the depth of an index, the distribution of data pages in each storage area, etc. may be obtained; for an ES database, the index name, the number of documents, the index size, the frequency of occurrence of various terms, etc. may be obtained; for MongoDB, the document size, the number of documents, the index size, etc. may be obtained.

[0070] Step 103 , using the query matching model, query matching is performed based on the query features and database features of each candidate database, and a target database is determined from the candidate databases.

[0071] The target database has a higher response speed to the data query request than other candidate databases.

[0072] In one possible implementation, the query matching model is pre-trained and can learn the relationship between the resource status of the database and the response speed of various data query tasks, and based on the query characteristics and database characteristics, determine the target database that is most suitable for responding to this data query request from the candidate databases.

[0073] Illustratively, the query matching model may select a machine learning model suitable for performing classification tasks, such as a random forest, a gradient boosting tree, or a deep learning model.

[0074] Step 104: Based on the data query request, the target database is called to perform data query and obtain the data query result.

[0075] After the target database is screened out, the data query request can be forwarded to the server corresponding to the target database, so that the server executes the corresponding query task, obtains the data query result, and displays the data query result through the client.

[0076] Based on the disclosed embodiments, by obtaining query features of a data query request and database features of a candidate database, the query features and database features are input into a query matching model, and the query matching model is used to screen out a target database that matches the data query request. The query matching model evaluates a suitable query method based on the data resource status of each candidate database, and automatically calls the screened target database for data query, thereby achieving a rapid response to data query results and improving data query efficiency. Moreover, when a new database is added to a business system, there is no need to redesign and adjust the data query logic, which reduces system update operations and can ensure the continuous operation of the business system. The target database screening and data query process are imperceptible to users and the business system.

[0077] In a possible implementation manner, before the above step 101, firstly, Figure 1 The query matching model in the embodiment shown is used for model training. Figure 2 As shown, the method provided by the embodiment of the present disclosure may also include the following steps:

[0078] Step 201: construct a training data set based on sample query features and sample database features corresponding to each sample database.

[0079] Step 202: Use the training data set to perform model training on the initial model until a preset training condition is met to obtain a query matching model.

[0080] In a possible implementation, the user's data query requests can be collected in advance, sample query features can be extracted from them, and corresponding sample database features can be obtained through the database interface of each sample database to construct a training data set. Each sample query feature carries a sample label, which is used to indicate the sample database that matches the sample query feature.

[0081] The preset training condition may include, for example, at least one of the following: the number of training times reaches a preset number of times, and the loss function value of the model is less than a preset function value. Optionally, in addition to constructing a training data set, a test data set may also be constructed to perform a model test on the query matching model using the test data set after the preset training condition is met, so as to further detect the model performance.

[0082] Specifically, the above step 202 may include the following steps:

[0083] Step 202a: input the sample query features and the sample database features into the initial model to obtain the model prediction results output by the initial model.

[0084] Step 202b, using the loss function, based on the model prediction results and the sample labels corresponding to the sample query features, calculate the loss function value of the above initial model, wherein the sample labels are used to indicate the sample database matching the sample query features.

[0085] Step 202c, back-propagating the initial function based on the loss function value to update the model parameters.

[0086] The initial model can select a machine learning model suitable for performing classification tasks, such as a random forest, a gradient boosting tree, or a deep learning model, etc. In principle, the loss function of the model can select a cross entropy loss function, a logarithmic loss function, a marginal ranking loss function, etc. The embodiment of the present disclosure does not limit the types of the initial model and the loss function.

[0087] Optionally, a language model may be used to identify query features from a data query request. The above step 101 may include the following steps:

[0088] Step 101a, parsing the data query request, obtaining the query text in the data query request, where the query text is obtained based on the user's data query operation.

[0089] Step 101b: Use the language model to perform intent recognition on the query text to obtain query features.

[0090] In a possible implementation, the database system in the disclosed embodiment can perform intent recognition on the query text input by the user in combination with the artificial intelligence model to extract query features. Schematically, an input box is displayed in the data query interface of the client, and the user can enter the query text through the input box and trigger the query control to generate a data query request. After receiving the data query request, the query text in the data query request is parsed and extracted, and the query text is input into a language model, such as a Chat Generative Pre-trained Transformer (ChatGPT) model, to perform intent recognition and obtain query features.

[0091] Based on the embodiments of the present disclosure, query text in a data query request is input into a language model for intent recognition to obtain query features, and query features are generated using artificial intelligence. This eliminates the need for users to enter standardized query text when performing data queries, reduces the requirements for users' database-related knowledge, reduces data query costs, and can improve data query efficiency.

[0092] Optionally, in addition to screening the target database, the query matching model in the above embodiment can also realize automatic generation of query statements in another possible implementation. The above step 104 can specifically include the following steps:

[0093] Step 104a, using the query matching model, generating a query statement matching the target database based on the query features.

[0094] After screening out the target database, the query matching model can automatically generate a query statement that conforms to the database syntax of the target database based on the query features, such as a Structured Query Language (SQL) statement.

[0095] Step 104b, calling the database client corresponding to the target database, sending a query statement to the server of the target database through the database client, and obtaining a data query result.

[0096] In a possible implementation, a database client corresponding to each database is provided in the database system, which is used to send a query statement to the database server to obtain a query result, for example, Elasticsearch High Level REST Client, Spring Data MongoDB, HBase Java API, etc.

[0097] In the disclosed embodiment, a query matching model is used to automatically generate a query statement that conforms to the database syntax of the target database. By calling a database client corresponding to the target database, the automatically generated query statement is input into the database client to obtain the query result. The user only needs to input a simple query text and does not need to have database syntax knowledge of various databases, making data query more efficient and convenient.

[0098] Optionally, the database system in the embodiment of the present disclosure adopts the storage form of MySQL database combined with sub-library and sub-table, and each candidate database is used to synchronously store the business data in the relational database. When a data update event (such as adding new data, deleting data, modifying data, etc.) occurs in the relational database, the corresponding candidate database needs to be synchronized for data update. The method provided in the embodiment of the present disclosure may also include the following steps:

[0099] The database log of the relational database is parsed by a log parsing tool to obtain a data update message, in which the database log records the data update instruction received by the relational database; and data synchronization of the candidate database is performed based on the data update message.

[0100] In a possible implementation, the relational database MySQL generates a database log, such as a binary log (Binlog), based on the data update instruction during operation. The database log can be subscribed to and parsed in real time through a log parsing tool (such as Canal) to extract the data update message corresponding to the data update instruction. The parsed data update message is forwarded to the corresponding candidate database, and is connected to the candidate database for storage after the data format conversion, thereby completing the synchronous update of the data. Create corresponding data tables and indexes in the candidate database, receive data update messages and update data tables and indexes. In order to adapt to different business data storage and query requirements, different storage structures and index strategies can be set in different candidate databases.

[0101] Specifically, a data update message may be sent to a message middleware (eg, Kafka, RabbitMQ, etc.), wherein the access configuration management layer of the candidate database is used to subscribe to the data update message of the message middleware, and perform data synchronization update based on the data update message.

[0102] Based on the disclosed embodiment, the database log based on the relational database records the data update message, which is parsed and processed by Canal and broadcast to the downstream candidate database through the message middleware to realize the automatic synchronization update of the data, thereby reducing the complexity and maintenance cost of data synchronization.

[0103] Indicative, Figure 3A flowchart of the data synchronization, data conversion storage and data query process in a database system is shown, wherein the above Figure 1 and Figure 2 The data query method in each embodiment can be applied to Figure 3 The query module shown in the above embodiment corresponds to a specific example of the data query module performing a data query task. Figure 3 In the application scenario shown, in the data synchronization stage: the business system sends business data update (such as adding data, modifying data, deleting data, etc.) instructions to MySQL. When executing the corresponding business data update instructions, MySQL updates the Binlog file, which records the data update instructions received by MySQL. Canal obtains and parses the MySQL Binlog file in real time and sends it to the message middleware (such as Kafka, RabbitMQ, etc.). MQ, etc.) to send corresponding data update messages; data conversion and storage stage: downstream candidate databases MongoDB, ES and HBase (only three databases are shown in the figure, and other types of databases may also be included) synchronize data updates by subscribing to messages in the message middleware. Each candidate database subscribes to messages in the message middleware and parses whether the business data involved in the read data update message is business data related to itself. If so, the business data is formatted and stored according to the corresponding storage structure, and the database index and other information are updated at the same time; data query stage: the query module in the system can receive data query requests sent by user devices, obtain query features based on the data query requests, and call the database features of candidate databases such as MongoDB, ES, HBase through the database interface. The query matching model in the query module is used to perform query matching based on the query features and the database features of each candidate database, determine the target database, and call the target database for data query according to the data query request. The specific process of the query module performing data query can refer to the above Figure 1 and Figure 2 Corresponding embodiments.

[0104] Please refer to Figure 4 , which shows a structural block diagram of a data query device provided by an exemplary embodiment of the present disclosure. The data query device provided by this embodiment can be applied to a database system. The device includes:

[0105] A first acquisition module 401 is used to respond to a data query request and acquire a query feature based on the data query request. The query feature may include but is not limited to at least one of a query method, a query condition, a query data type, and a query data volume;

[0106] A second acquisition module 402 is used to acquire database characteristics of each candidate database, where the database characteristics are used to indicate at least one of the following: storage data volume, index structure, and data dispersion degree;

[0107] The determination module 403 is used to use the query matching model to perform query matching based on the query features obtained by the first acquisition module 401 and the database features of each candidate database obtained by the second acquisition module 402, and determine a target database from the candidate databases, the target database responding to the data query request in the first acquisition module 401 at a faster speed than the response speeds of other candidate databases to the data query request;

[0108] The query module 404 is used to call the target database determined by the determination module 403 based on the data query request to perform data query and obtain the data query result.

[0109] Optionally, in a possible implementation manner, as Figure 5 As shown, the device provided by the embodiment of the present disclosure may also include:

[0110] A construction module 501 is used to construct a training data set based on the sample query features and the sample database features corresponding to each sample database;

[0111] The training module 502 uses the training data set constructed by the construction module 501 to perform model training on the initial model until the preset training conditions are met, thereby obtaining the query matching model in the above embodiment.

[0112] Optionally, in a possible implementation manner, the training module 502 is further configured to:

[0113] Inputting sample query features and sample database features into the initial model to obtain a model prediction result output by the initial model;

[0114] Using the loss function, the loss function value of the initial model is calculated based on the model prediction results and the sample labels corresponding to the sample query features, where the sample labels are used to indicate the sample database that matches the sample query features;

[0115] The initial function is back-propagated based on the loss function value to update the model parameters.

[0116] Optionally, in a possible implementation manner, the first acquisition module 401 is further configured to:

[0117] Parsing the data query request and obtaining the query text in the data query request, where the query text is obtained based on the user's data query operation;

[0118] The language model is used to identify the intent of the above query text to obtain query features.

[0119] Optionally, in a possible implementation manner, the query module 404 is further configured to:

[0120] Using the query matching model, based on the query features acquired by the first acquisition module 401, a query statement matching the target database is generated;

[0121] Call the database client corresponding to the target database, send query statements to the server of the target database through the database client, and obtain data query results.

[0122] Optionally, in a possible implementation manner, the candidate database is used to synchronously store business data in a relational database; the apparatus provided by the embodiment of the present disclosure may further include:

[0123] A parsing module, used to parse a database log of a relational database through a log parsing tool to obtain a data update message, wherein the database log records the data update instruction received by the relational database;

[0124] The updating module is used to synchronously update the data of the candidate database based on the data updating message parsed by the parsing module.

[0125] Optionally, in a possible implementation manner, the update module may also be used to:

[0126] The data update message obtained by parsing the parsing module is sent to the message middleware, wherein the access configuration management layer of the candidate database is used to subscribe to the data update message of the message middleware and perform data synchronization update based on the data update message.

[0127] In addition, an embodiment of the present disclosure further provides an electronic device, including:

[0128] Memory for storing computer programs;

[0129] The processor is used to execute the computer program stored in the memory, and when the computer program is executed, the data query method described in any of the above embodiments of the present disclosure is implemented.

[0130] Figure 6 This is a schematic diagram of the structure of an application embodiment of the electronic device disclosed in the present invention. Figure 6 The electronic device according to the embodiment of the present disclosure is described. The electronic device may be any one or both of the first device and the second device, or a stand-alone device independent of them, and the stand-alone device may communicate with the first device and the second device to receive the collected input signals from them.

[0131] like Figure 6As shown, the electronic device includes one or more processors and memory.

[0132] The processor may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device to perform desired functions.

[0133] The memory may include one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, a random access memory (RAM) and / or a cache memory (cache), etc. The non-volatile memory may include, for example, a read-only memory (ROM), a hard disk, a flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor may execute the program instructions to implement the data query method of each embodiment of the present disclosure described above and / or other desired functions.

[0134] In one example, the electronic device may further include: an input device and an output device, and these components are interconnected via a bus system and / or other forms of connection mechanisms (not shown).

[0135] In addition, the input device may also include, for example, a keyboard, a mouse, and the like.

[0136] The output device can output various information to the outside, including the determined distance information, direction information, etc. The output device can include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, and the like.

[0137] Of course, to simplify, Figure 6 Only some of the components related to the present disclosure in the electronic device are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, according to specific application situations, the electronic device may further include any other appropriate components.

[0138] In addition to the above-mentioned methods and devices, an embodiment of the present disclosure may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps of the data query method according to various embodiments of the present disclosure described in the above part of this specification.

[0139] The computer program product may be written in any combination of one or more programming languages ​​to write program code for performing the operations of the disclosed embodiments, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0140] In addition, an embodiment of the present disclosure may also be a computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, enables the processor to execute the steps of the data query method according to various embodiments of the present disclosure described in the above part of this specification.

[0141] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable 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 above.

[0142] A person of ordinary skill in the art can understand that all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above-mentioned method embodiment; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk, etc., various media that can store program codes.

[0143] The basic principles of the present disclosure are described above in conjunction with specific embodiments. However, it should be noted that the advantages, strengths, effects, etc. mentioned in the present disclosure are only examples and not limitations, and it cannot be considered that these advantages, strengths, effects, etc. are required by each embodiment of the present disclosure. In addition, the specific details disclosed above are only for the purpose of illustration and ease of understanding, and are not limitations. The above details do not limit the present disclosure to the necessity of adopting the above specific details to be implemented.

[0144] Each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the system embodiment, since it basically corresponds to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0145] The block diagrams of the devices, apparatuses, equipment, and systems involved in this disclosure are only illustrative examples and are not intended to require or imply that they must be connected, arranged, and configured in the manner shown in the block diagrams. As will be appreciated by those skilled in the art, these devices, apparatuses, equipment, and systems can be connected, arranged, and configured in any manner. Words such as "including," "comprising," "having," and the like are open words, referring to "including but not limited to," and can be used interchangeably therewith. The words "or" and "and" used herein refer to the words "and / or," and can be used interchangeably therewith, unless the context clearly indicates otherwise. The word "such as" used herein refers to the phrase "such as but not limited to," and can be used interchangeably therewith.

[0146] The method and apparatus of the present disclosure may be implemented in many ways. For example, the method and apparatus of the present disclosure may be implemented by software, hardware, firmware, or any combination of software, hardware, and firmware. The above order of steps for the method is for illustration only, and the steps of the method of the present disclosure are not limited to the order specifically described above, unless otherwise specifically stated. In addition, in some embodiments, the present disclosure may also be implemented as a program recorded in a recording medium, which includes machine-readable instructions for implementing the method according to the present disclosure. Therefore, the present disclosure also covers a recording medium storing a program for executing the method according to the present disclosure.

[0147] It should also be noted that in the apparatus, device and method of the present disclosure, each component or each step can be decomposed and / or recombined. Such decomposition and / or recombination should be regarded as equivalent solutions of the present disclosure.

[0148] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of the present disclosure. Therefore, the present disclosure is not intended to be limited to the aspects shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

[0149] The above description has been given for the purpose of illustration and description. In addition, this description is not intended to limit the embodiments of the present disclosure to the forms disclosed herein. Although multiple example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, changes, additions and sub-combinations thereof.

Claims

1. A data query method, characterized in that: include: In response to a data query request, obtaining a query feature based on the data query request, the query feature including at least one of a query mode, a query condition, a query data type, and a query data amount; Acquire database characteristics of each candidate database, wherein the database characteristics include at least one of a storage data volume, a database index parameter, and a data dispersion degree; Using a query matching model, query matching is performed based on the query characteristics and the database characteristics of each candidate database, and a target database is determined from the candidate databases, wherein the target database has a response speed to the data query request greater than the response speeds of other candidate databases to the data query request; Based on the data query request, the target database is called to perform data query and obtain data query results.

2. The method according to claim 1, characterized in that The method further comprises: Building a training data set based on sample query features and sample database features corresponding to each sample database; The initial model is trained using the training data set until a preset training condition is met to obtain the query matching model.

3. The method according to claim 2, characterized in that The using the training data set to perform model training on the initial model includes: Inputting the sample query feature and the sample database feature into the initial model to obtain a model prediction result output by the initial model; Calculating the loss function value of the initial model based on the model prediction result and the sample label corresponding to the sample query feature using a loss function, wherein the sample label is used to indicate a sample database matching the sample query feature; The initial function is back-propagated based on the loss function value to update the model parameters.

4. The method according to any one of claims 1 to 3, characterized in that: The acquiring query features based on the data query request includes: Parsing the data query request to obtain a query text in the data query request, where the query text is obtained based on a data query operation of a user; The language model is used to perform intent recognition on the query text to obtain the query features.

5. The method according to any one of claims 1 to 3, characterized in that: The step of calling the target database to perform data query based on the data query request and obtaining the data query result includes: Using the query matching model, generating a query statement matching the target database based on the query features; The database client corresponding to the target database is called, and the query statement is sent to the server of the target database through the database client to obtain the data query result.

6. The method according to any one of claims 1 to 3, characterized in that: The candidate database is used to synchronously store business data in the relational database; The method further comprises: Parsing a database log of a relational database by a log parsing tool to obtain a data update message, wherein the database log records the data update instruction received by the relational database; The candidate database is updated synchronously based on the data update message.

7. The method according to claim 6, characterized in that The synchronously updating the data of the candidate database based on the data update message includes: The data update message is sent to the message middleware, wherein the access configuration management layer of the candidate database is used to subscribe to the data update message of the message middleware and perform data synchronization update based on the data update message.

8. A data query device, characterized in that: include: A first acquisition module, configured to respond to a data query request and acquire a query feature based on the data query request, wherein the query feature includes at least one of a query mode, a query condition, a query data type, and a query data volume; A second acquisition module, used to acquire database characteristics of each candidate database, wherein the database characteristics are used to indicate at least one of the amount of stored data, the index structure and the degree of data dispersion; A determination module, configured to use a query matching model to perform query matching based on the query characteristics and the database characteristics of each candidate database, and determine a target database from the candidate databases, wherein the target database has a response speed to the data query request greater than the response speeds of other candidate databases to the data query request; The query module is used to call the target database to perform data query based on the data query request and obtain data query results.

9. An electronic device, characterized in that: include: Memory for storing computer programs; A processor is used to execute the computer program stored in the memory, and when the computer program is executed, the method described in any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method described in any one of claims 1 to 7 is implemented.

11. A computer program comprising computer program instructions, characterized in that When the computer program instructions are executed by a processor, the method described in any one of claims 1 to 7 is implemented.