Data query method and device, computer device, readable storage medium and program product

By providing a dynamic selection of database and search engine query methods on the data query page, the problem of not being able to balance the query speed of real-time data and historical data is solved, thereby improving data query efficiency and business processing timeliness.

CN119377262BActive Publication Date: 2025-11-07CHINA SOUTHERN POWER GRID INTERNET SERVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411462054.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-18
Publication Date
2025-11-07
Estimated Expiration
2044-10-18

AI Technical Summary

Technical Problem

Existing technologies struggle to balance query speeds for both real-time and historical data, resulting in poor timeliness in business processing.

Method used

This paper provides a data query method that simultaneously offers database query and search engine query options on the data query page. The query method is dynamically selected based on the query conditions and the data segment update frequency, ensuring the rapid acquisition of real-time and historical data.

Benefits of technology

It enables the rapid and accurate acquisition of real-time and historical data under different data conditions, improving the overall efficiency of data query and reducing the waiting time for business processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119377262B_ABST
    Figure CN119377262B_ABST
Patent Text Reader

Abstract

The application relates to a data query method and device, computer equipment, a computer readable storage medium and a computer program product, relates to the technical field of data search, and can consider the query speed of real-time data and historical data. The method comprises the following steps: a data query page is displayed; the data query page is simultaneously provided with a first query mode and a second query mode, the first query mode comprises searching in a database storing business data, and the second query mode comprises searching in data shards corresponding to the business data through a search engine; a data query operation of requesting to query target data is triggered on the data query page, a target query mode is determined from the first query mode and the second query mode; and an interface corresponding to the target query mode is called to query the target data through the target query mode.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data search, and in particular to a data query method and device, computer equipment, computer readable storage medium and computer program product. BACKGROUND

[0002] With the development of computer technology, in order to improve the speed of finding specified data in a large amount of data, in the related technology, the data can be synchronized to the search engine, and the fast query mechanism of the search engine is used for searching, which can significantly improve the response speed during data query.

[0003] However, the inventor found in practice that although the above method can effectively improve the data query speed, for the recently updated business data, the above method often cannot be queried in time, which affects business processing. It can be seen that the related technology has the problem of being difficult to balance the query speed of real-time data and historical data. SUMMARY

[0004] Therefore, it is necessary to provide a data query method and device, computer equipment, computer readable storage medium and computer program product that balance the query speed of real-time data and historical data in view of the above technical problems.

[0005] In a first aspect, the present application provides a data query method, comprising:

[0006] displaying a data query page; the data query page is provided with a first query mode and a second query mode, the first query mode includes searching in a database storing business data, and the second query mode includes searching in a data shard corresponding to the business data through a search engine;

[0007] determining a target query mode from the first query mode and the second query mode according to a data query operation triggered in the data query page to request query target data;

[0008] calling an interface corresponding to the target query mode to query the target data through the target query mode.

[0009] In one embodiment, the method further comprises:

[0010] obtaining a query condition of the target data according to the data query operation triggered in the data query page to request query target data;

[0011] determine a recommended query mode matching the query condition from the first query mode and the second query mode, and determine a target query mode based on the recommended query mode.

[0012] In one of the embodiments, the determining of the recommended query mode matching the query condition from the first query mode and the second query mode comprises:

[0013] if the query condition is a time search range corresponding to the target data, obtaining an update frequency of a data shard related to the target data in the search engine;

[0014] if it is determined according to the update frequency that the data shard related to the target data in the time search range is not updated, taking the first query mode as the recommended query mode;

[0015] if it is determined according to the update frequency that the data shard related to the target data in the time search range is updated, taking the second query mode as the recommended query mode.

[0016] In one of the embodiments, the calling of the interface corresponding to the target query mode comprises:

[0017] if the target query mode is the first query mode, displaying a query condition adding prompt for prompting a user to add other query conditions except the time search range;

[0018] receiving the added other query conditions, generating an interface calling request containing the time search range and the other query conditions, and sending the interface calling request to the interface corresponding to the first query mode.

[0019] In one of the embodiments, the determining of the recommended query mode matching the query condition from the first query mode and the second query mode comprises:

[0020] if the query condition comprises multiple query conditions, predicting a query speed comparison result of the first query mode and the second query mode under the multiple query conditions;

[0021] determining a recommended query mode from the first query mode and the second query mode according to the query speed comparison result.

[0022] In one of the embodiments, the predicting of the query speed comparison result of the first query mode and the second query mode under the multiple query conditions comprises:

[0023] calling a pre-trained query speed prediction model, inputting the plurality of query conditions into the query speed prediction model, and obtaining a query speed comparison result of the first query mode and the second query mode;

[0024] The query speed prediction model is trained based on a sample query condition set and a query speed label. The query speed label represents a query speed comparison result of the first query mode and the second query mode when data query is performed based on a plurality of sample query conditions in the sample query condition set.

[0025] In a second aspect, the present application further provides a data query device, comprising:

[0026] a page display module configured to display a data query page; the data query page is provided with a first query mode and a second query mode simultaneously, the first query mode comprises searching in a database storing business data, and the second query mode comprises searching in a data shard corresponding to the business data through a search engine;

[0027] a target query mode determination module configured to determine a target query mode from the first query mode and the second query mode according to a data query operation of requesting to query target data triggered in the data query page;

[0028] a data query module configured to call an interface corresponding to the target query mode to query the target data through the target query mode.

[0029] In a third aspect, the present application further provides a computer device, comprising a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:

[0030] displaying a data query page; the data query page is provided with a first query mode and a second query mode simultaneously, the first query mode comprises searching in a database storing business data, and the second query mode comprises searching in a data shard corresponding to the business data through a search engine;

[0031] determining a target query mode from the first query mode and the second query mode according to a data query operation of requesting to query target data triggered in the data query page;

[0032] calling an interface corresponding to the target query mode to query the target data through the target query mode.

[0033] In a fourth aspect, the present application further provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the following steps:

[0034] displaying a data query page; the data query page is provided with a first query mode and a second query mode simultaneously, the first query mode comprises searching in a database storing business data, and the second query mode comprises searching in a data shard corresponding to the business data through a search engine;

[0035] determining a target query mode from the first query mode and the second query mode according to a data query operation of requesting to query target data triggered in the data query page;

[0036] calling an interface corresponding to the target query mode to query the target data through the target query mode.

[0037] In a fifth aspect, the present application further provides a computer program product comprising a computer program which, when executed by a processor, implements the following steps:

[0038] displaying a data query page; the data query page is provided with a first query mode and a second query mode simultaneously, the first query mode comprises searching in a database storing business data, and the second query mode comprises searching in a data shard corresponding to the business data through a search engine;

[0039] determining a target query mode from the first query mode and the second query mode according to a data query operation of requesting to query target data triggered in the data query page;

[0040] calling an interface corresponding to the target query mode to query the target data through the target query mode.

[0041] The data query method, device, computer device, computer readable storage medium and computer program product can display a data query page, the data query page simultaneously provides a first query mode and a second query mode, the first query mode includes searching in a database storing business data, and the second query mode includes searching in a data shard corresponding to the business data through a search engine; in response to a data query operation of requesting to query target data triggered in the data query page, a target query mode can be determined from the first query mode and the second query mode, and then an interface corresponding to the target query mode is called to query the target data through the target query mode. In this embodiment, by simultaneously providing the first query mode and the second query mode and determining the target query mode from the first query mode and the second query mode when receiving the data query operation, the search engine can be used for fast searching or the database can be directly searched according to actual conditions, on the one hand, the business data synchronized to the search engine in time can be quickly obtained through the first query mode, and on the other hand, the business data not synchronized to the search engine in time can be obtained in the database in time through the second query mode, so that the query speed of real-time data and historical data can be effectively considered. BRIEF DESCRIPTION OF DRAWINGS

[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related art, the following will briefly introduce the drawings needed to be used in the description of the embodiments of the present application or the related art. Obviously, the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.

[0043] Figure 1 A flowchart of a data query method in one embodiment;

[0044] Figure 2 A flowchart of a step of determining a target query mode in one embodiment;

[0045] Figure 3 A flowchart of another data query method in one embodiment;

[0046] Figure 4 A structural block diagram of a data query device in one embodiment;

[0047] Figure 5 An internal structure diagram of a computer device in one embodiment. DETAILED DESCRIPTION

[0048] In order to make the purposes, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and not intended to limit the present application.

[0049] In one embodiment, as shown in Figure 1 A data query method is provided, and the present embodiment is exemplified by the method applied to a terminal. It should be understood that the method can also be applied to a system including a terminal and a server and implemented through the interaction of the terminal and the server. The terminal can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things device can be a smart speaker, a smart television, a smart air conditioner, a smart vehicle device, a projection device, etc. The portable wearable device can be a smart watch, a smart bracelet, a head-mounted device, etc. The head-mounted device can be a virtual reality (VR) device, an augmented reality (AR) device, smart glasses, etc. The server can be a standalone physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.

[0050] In the present embodiment, the method includes the following steps:

[0051] S101, a data query page is displayed; the data query page is provided with a first query mode and a second query mode, the first query mode includes searching in a database storing business data, and the second query mode includes searching in a data shard corresponding to the business data through a search engine.

[0052] In specific implementation, the data query page can be set for the user to query data. In the present embodiment, at least two query modes for querying data are provided for the user to select and query data. For the sake of distinction, the mode of searching in the database storing business data to obtain the data to be queried is referred to as the first query mode, and the mode of searching in the data shard corresponding to the business data through the search engine is referred to as the second query mode. Then, after detecting a trigger event of the user requesting to query data, the data query page can be displayed on the terminal for the user to query data through the multiple data query modes provided in the data query page.

[0053] In some embodiments, in response to one or more operations of the user on the business data such as addition, deletion or modification, the originally stored business data in the database can be updated in time, and in addition, the business data in the database can be synchronized to the search engine according to a preset business logic.

[0054] Exemplarily, the first query mode can be querying through a database query statement, for example, corresponding data records can be queried in the database according to a structured query language (SQL) statement or a natural language statement provided by the user. The second query mode can be searching, by a search engine, data shards corresponding to the synchronized business data in a distributed search manner. For example, a search engine database corresponding to the search engine can include data shards corresponding to the synchronized business data, which can be understood as being obtained by slicing the synchronized business data. After obtaining a query request including a query condition, the search engine can perform data query according to the data shards and the inverted index. In an example, the second query mode can be implemented through an Elasticsearch search engine.

[0055] In S102, a target query mode is determined from the first query mode and the second query mode according to a data query operation triggered by the user on the data query page to query target data.

[0056] The target data can be business data that the user intends to find and obtain.

[0057] In a specific implementation, although the database storing the business data can synchronize the business data to the search engine, and the search engine can quickly perform data query through the second query mode. However, in some cases, for frequent business data update operations in the database, for example, when a large amount of data is added or changed, data blocking often occurs, and the newly added real-time data cannot be quickly and accurately queried through the search engine. The user needs to wait for a period of time, and after the search engine completes data synchronization, the user can continue to normally query data, which has a great impact on business processing. In other words, for the second data query mode, in some cases, the query speed of the second data query mode can be faster than that of the first data query mode, which can effectively improve the business data query efficiency, but there is a problem of instability of real-time data, especially when a large amount of data is inserted and updated, the data queried by the page will be delayed, which causes the newly added data to be unable to be queried.

[0058] In this embodiment, in response to the data query operation triggered by the user on the data query page to query target data, one of the first query mode and the second query mode can be selected as a target query mode.

[0059] In an embodiment, a query mode switching button can be set in the data query page, which can be used to control the target query mode currently used, for example, the user can control whether to use the first query mode or the second query mode through the switching button. When the data query operation contains a control operation on the switching button, the query mode selected by the user can be determined as the target query mode from the first query mode and the second query mode according to the control operation. In some examples, if the data query page displays business data in a preset historical time period by default, such as data in the past week, the switching button can default to the second query mode. When the user needs to query the most recently updated real-time data, the button can be switched to the first query mode.

[0060] In another embodiment, after detecting the data query operation, one or more data storage characteristics of the target data to be queried can be determined, such as the storage time of the target data to the database, the time or frequency of synchronization to the search engine, and the like. Then, the device can match the appropriate query mode from the first query mode and the second query mode as the target query mode according to the obtained data storage characteristics.

[0061] S103, calling an interface corresponding to the target query mode to query the target data through the target query mode.

[0062] After obtaining the target query mode, the target data can be queried through the target query mode. Specifically, in this embodiment, the query interface of the backend server can be provided with a data interface supporting the first query mode and a data interface supporting the second query mode at the same time. After determining the target query mode, the terminal can call the interface corresponding to the target query mode to query the target data through the interface.

[0063] In the data query method, a data query page can be displayed, and the data query page simultaneously provides a first query mode and a second query mode. The first query mode includes searching in a database storing business data, and the second query mode includes searching in a data shard corresponding to the business data through a search engine. Then, in response to a data query operation of requesting to query target data triggered on the data query page, a target query mode can be determined from the first query mode and the second query mode, and then an interface corresponding to the target query mode is called to query the target data through the target query mode. In this embodiment, by simultaneously providing the first query mode and the second query mode and determining the target query mode from the first query mode and the second query mode when receiving the data query operation, the search engine can be used for fast searching or searching directly in the database according to actual conditions. On the one hand, for business data that has been synchronized to the search engine in time, the first query mode can be used to quickly obtain the business data. On the other hand, for business data that has not been synchronized to the search engine in time, the second query mode can be used to quickly obtain the business data in the database, so that the query speed of real-time data and historical data can be effectively considered.

[0064] In one embodiment, as shown in FIG. 1, in step S102, the target query mode is determined from the first query mode and the second query mode according to the data query operation of requesting to query the target data triggered on the data query page, which can include the following steps: Figure 2

[0065] S201, obtaining a query condition of the target data according to the data query operation of requesting to query the target data triggered on the data query page.

[0066] In actual application, when the user triggers the data query operation, the user can set the query condition of the target data on the data query page. The query condition can be understood as a query condition of the device provided by the user when querying the target data. The device can use the target query mode to query in combination with the query condition to obtain the target data.

[0067] In this step, the query condition corresponding to the target data can be obtained according to the query statement input by the user on the data query page. For example, the query condition can include a time search range, or can include an object related to the target data, such as an enterprise or company name, or can include a data state of the target data, for example, when the target data is a bill, the query condition can include a bill state. It can be understood that the query condition of the target data can include one or more.

[0068] S202, determining a recommended query mode matched with the query condition from the first query mode and the second query mode, and determining the target query mode based on the recommended query mode.

[0069] ​Since there can be a large difference in the clues and data query range provided to the device under different query conditions, the query speed using the first query mode or the second query mode can also differ. After obtaining the query condition corresponding to the target data, the recommended query mode that matches the query condition can be determined from the first query mode and the second query mode. The recommended query mode can be understood as a query mode with higher query speed under the current query condition.

[0070] In some embodiments, the recommended query mode can be sent to the user, and after receiving the confirmation information of the user, the recommended query mode is used as the target query mode; or the selected recommended query mode can also be directly used as the target query mode.

[0071] In this embodiment, after obtaining the query condition, the recommended query mode that matches the query condition can be quickly and efficiently determined from the first query mode and the second query mode, and the target query mode is determined. On the one hand, the selected target query mode can match the query condition currently provided by the user, and on the other hand, the appropriate target query mode can be selected without the need to combine experience, thereby reducing the use threshold of the user.

[0072] In one embodiment, in step S202, determining the recommended query mode that matches the query condition from the first query mode and the second query mode can include the following steps:

[0073] If the query condition is a time search range corresponding to the target data, the update frequency of the data shard related to the target data in the search engine is obtained. In the case where it is determined according to the update frequency that the data shard related to the target data in the time search range has not been updated, the first query mode is used as the recommended query mode. In the case where it is determined according to the update frequency that the data shard related to the target data in the time search range has been updated, the second query mode is used as the recommended query mode.

[0074] The time search range can be understood as a time range used when searching for the target data. For example, the time range can be the storage time range of the target data, or other time ranges. For example, when the target data is a document, the time search range can be the time range of the occurrence of the business corresponding to the document.

[0075] In actual application, if the query condition is a time search range corresponding to the target data, the update frequency of the data shard related to the target data in the search engine can be obtained. Different types of data shards in the search engine can be configured with different update frequencies, and the search engine can update the data shards of the corresponding type according to the update frequency. After detecting the data query operation, the type of the target data can be determined, and the update frequency of the data shard of the type can be obtained.

[0076] After obtaining the update frequency, the time search range can be compared with the update frequency, and it is identified whether the data slice related to the target data in the search engine has been updated according to the comparison result. For example, for the data slice of the bill type A, the update frequency is once a week, and the device can infer the predicted update time after the historical update time according to the pre-stored past latest historical update time. If the predicted update time matches the time search range, for example, the time search range is earlier than the predicted update time, it can be determined that the data slice related to the target data has been updated. If the predicted update time does not match the time search range, for example, the time search range is later than the predicted update time, it can be determined that the data slice related to the target data has not been updated.

[0077] In the case where it is determined that the data slice related to the target data has not been updated, the first query mode can be used as the recommended query mode, so that the real-time updated target data can be accurately obtained by querying the database. In the case where it is determined that the data slice related to the target data has been updated, the second query mode can be used as the recommended query mode, so as to improve the data query speed. In some cases, the data synchronization logic of the search engine can be relatively complex. Compared with directly comparing the time search range and the latest update time, in the embodiment, the update frequency is used to predict whether the data slice has been updated, which can also increase a certain redundancy space. For example, although the time search range is later than the latest update time, if the latest update time is close (for example, the time difference is less than a preset threshold), it can still be considered that the data slice related to the target data has been updated. A period of time can be waited until the latest update time arrives, and the latest target data can be obtained.

[0078] In the embodiment, the update frequency of the data slice and the time search range of the target data can be used to effectively identify whether the data slice related to the target data has been updated, so as to accurately select the first query mode or the second query mode as the recommended query mode, improve the reliability and rationality of the recommended query mode, and avoid too many requests for database query at the same time, which can cause the database pressure to increase.

[0079] In addition, on the one hand, in order to solve the problem that the timeliness of data query is poor due to a large amount of data insertion and update, the search engine cannot obtain real-time data or is more likely to fail to obtain real-time data, the first query mode can be recommended as a recommended query mode by the embodiment, the user is prompted to switch from the second query mode to the first query mode in time, the database can be quickly switched to for query, real-time data can be obtained for business processing, time waiting is avoided, the query efficiency of real-time data is improved, and the business development is not affected. On the other hand, for business data synchronized to the search engine, the second query mode is recommended for data query, so that the database pressure is reduced while the data query speed is improved.

[0080] In one embodiment, calling the interface corresponding to the target query mode can include the following steps:

[0081] If the target query mode is the first query mode, a query condition adding prompt is displayed, the query condition adding prompt is used to prompt the user to add other query conditions except the time search range, the added other query conditions are received, an interface calling request containing the time search range and the other query conditions is generated, and the interface calling request is sent to the interface corresponding to the first query mode.

[0082] When the user-provided query condition is the time search range, it may take a long time to search in the database by using the first query mode. In this case, after determining that the target query mode is the first query mode, a query condition adding prompt can be displayed to the user to prompt the user to add other query conditions except the time search range. Then, after obtaining the other query conditions added by the user, an interface calling request containing the time search range and the other query conditions can be generated and sent to the interface corresponding to the first query mode to call the interface corresponding to the first query mode.

[0083] In the embodiment, when it is determined that the target query mode is the first query mode, the query condition adding prompt is displayed to add more other query conditions in time, and then the interface corresponding to the first query mode is called, so that the query range is reduced when the database is used to query target data, and the query accuracy is improved, thereby improving the real-time data query efficiency when the data query mode is switched to the first query mode.

[0084] In one embodiment, in step S202, determining the recommended query mode matching the query condition from the first query mode and the second query mode can include the following steps:

[0085] If the query condition includes multiple query conditions, the query speed comparison results of the first query mode and the second query mode are predicted according to the multiple query conditions, and the recommended query mode is determined from the first query mode and the second query mode according to the query speed comparison results.

[0086] In some embodiments, the user can configure multiple query conditions in the data query page at the same time, for example, the multiple query conditions can be query conditions involving different aspects of information, and due to the multiple query conditions, the user can have difficulty in selecting the appropriate query condition from the two alternative query modes in time. In the present embodiment, when the query conditions include multiple query conditions, the comparison result of the query speed of the first query mode and the second query mode under the multiple query conditions can be predicted first, so as to determine the comparison result of the query speed when the first query mode and the second query mode respectively use the multiple query conditions to query data.

[0087] Further, the recommended query mode can be determined from the first query mode and the second query mode according to the comparison result of the query speed, for example, the query mode with faster query speed can be determined from the first query mode and the second query mode as the recommended query mode, and if they are the same, the second query mode can be taken as the recommended query mode to reduce the database pressure.

[0088] In the present embodiment, when there are multiple query conditions, the comparison result of the query speed can be predicted to recommend a better query mode for the user and improve the query speed under different query conditions.

[0089] In one embodiment, predicting the comparison result of the query speed of the first query mode and the second query mode under the multiple query conditions can include the following steps:

[0090] The pre-trained query speed prediction model is called, and the multiple query conditions are input into the query speed prediction model to obtain the comparison result of the query speed of the first query mode and the second query mode.

[0091] The query speed prediction model is trained based on a sample query condition set and a query speed label, and the query speed label represents the comparison result of the query speed of the first query mode and the second query mode when data is queried based on the multiple sample query conditions in the sample query condition set.

[0092] In a specific implementation, the query speed prediction model can be pre-trained. In some optional embodiments, the query speed prediction model can be obtained by training a neural network model. During training, a plurality of sample query condition sets and corresponding query speed labels of each sample query condition can be set. Each sample query condition set includes a plurality of sample query conditions. The corresponding query speed label of the sample query condition set can indicate the comparison result of the query speed of the first query mode and the second query mode based on each sample query condition in the same sample query condition set. Then, the sample query condition set can be input into the query speed prediction model to be trained to obtain the prediction result output by the model. The difference between the prediction result and the query speed label is used to determine the model loss value. The model parameters are adjusted according to the model loss value. When the training end condition is met, the trained query speed prediction model is obtained.

[0093] Further, when the user inputs a plurality of query conditions into the data query page, the pre-trained query speed prediction model can be called to input the plurality of query conditions into the query speed prediction model to obtain the comparison result of the query speed of the first query mode and the second query mode.

[0094] In this embodiment, by pre-training the query speed prediction model and learning the comparison result of the query speed of the first query mode and the second query mode in different situations through the model, the accuracy of accurately identifying the comparison result of the query speed under different query conditions by the device can be improved, which helps to select a more accurate query mode.

[0095] In order for those skilled in the art to better understand the above steps, the embodiments of the present application are exemplarily illustrated by an example below, but it should be understood that the embodiments of the present application are not limited thereto.

[0096] As shown in Figure 3 After entering the data query page, the search engine can be used to query the target data under the default query condition, for example, the search engine is used to find the latest target data in a specified time period by default. If the target data is found, the target data is displayed on the page. If the target data is not found, the page is switched to database query. Since the query is performed in the database, it can be prompted to add more query conditions, narrow the query range, and reduce the database pressure, for example, to query only the data of the current day. Then, the target data obtained by the query can be displayed on the page. Subsequently, the user can perform business operations on the target data displayed on the page.

[0097] In the present example, by supporting database and search engine for querying at the same time, the problem of slow data volume synchronization can be effectively solved. When the latest real-time data cannot be obtained through the search engine when querying, the latest real-time data is obtained through switching to use the database to query, and business processing is performed, thereby avoiding poor timeliness and improving user experience and business processing efficiency.

[0098] It should be understood that, although each step in the flowchart involved in each embodiment as described above is shown in sequence according to the arrow, these steps are not necessarily executed in sequence according to the arrow. Unless otherwise specified herein, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other sequences. Moreover, at least part of the steps in the flowchart involved in each embodiment as described above can include multiple steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence of these steps or stages is not necessarily sequential, but can be executed in rotation or alternation with at least part of other steps or steps or stages in other steps.

[0099] Based on the same inventive concept, the present application also provides a data query device for implementing the above-mentioned data query method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme described in the above method, so the specific limitations in one or more data query device embodiments provided below can refer to the limitations of the data query method in the above text, which will not be repeated here.

[0100] In one exemplary embodiment, as shown in Figure 4 a data query device is provided, comprising:

[0101] a page display module 401 configured to display a data query page; the data query page is provided with a first query mode and a second query mode at the same time, the first query mode includes searching in a database storing business data, and the second query mode includes searching in a data shard corresponding to the business data through a search engine;

[0102] a target query mode determination module 402 configured to determine a target query mode from the first query mode and the second query mode according to a data query operation of requesting to query target data triggered in the data query page;

[0103] a data query module 403 configured to call an interface corresponding to the target query mode to query the target data through the target query mode.

[0104] In one embodiment, the target query mode determination module 402 is configured to:

[0105] According to the data query operation triggered by the data query page to request target data, a query condition of the target data is acquired;

[0106] A recommended query mode matched with the query condition is determined from the first query mode and the second query mode, and a target query mode is determined based on the recommended query mode.

[0107] In an embodiment, the target query mode determination module 402 is configured to:

[0108] If the query condition is a time search range corresponding to the target data, an update frequency of a data shard related to the target data in the search engine is acquired;

[0109] In a case where it is determined according to the update frequency that the data shard related to the target data in the time search range is not updated, the first query mode is taken as the recommended query mode;

[0110] In a case where it is determined according to the update frequency that the data shard related to the target data in the time search range is updated, the second query mode is taken as the recommended query mode.

[0111] In an embodiment, the calling of the interface corresponding to the target query mode comprises:

[0112] If the target query mode is the first query mode, a query condition addition prompt is displayed, and the query condition addition prompt is used to prompt a user to increase other query conditions except the time search range;

[0113] The other query conditions added are received, an interface calling request containing the time search range and the other query conditions is generated, and the interface calling request is sent to the interface corresponding to the first query mode.

[0114] In an embodiment, the target query mode determination module 402 is configured to:

[0115] If the query condition comprises a plurality of query conditions, a query speed comparison result of the first query mode and the second query mode under the plurality of query conditions is predicted;

[0116] According to the query speed comparison result, a recommended query mode is determined from the first query mode and the second query mode.

[0117] In an embodiment, the target query mode determination module 402 is configured to:

[0118] The pre-trained query speed prediction model is called, and the plurality of query conditions are input into the query speed prediction model to obtain a query speed comparison result of the first query mode and the second query mode.

[0119] The query speed prediction model is trained based on a sample query condition set and a query speed label, and the query speed label represents a query speed comparison result of the first query mode and the second query mode when data query is performed based on a plurality of sample query conditions in the sample query condition set.

[0120] The modules in the data query apparatus can be implemented by software, hardware, or a combination thereof. The modules can be embedded in or independent of a processor in a computer device in a hardware form, or stored in a memory in a computer device in a software form, so as to be called and executed by a processor to perform operations corresponding to the modules.

[0121] In an exemplary embodiment, a computer device, which can be a terminal, has an internal structure as shown in Figure 5 The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, the memory, and the input / output interface are connected through a system bus, and the communication interface, the display unit, and the input device are connected to the system bus through the input / output interface. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for running the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is configured to exchange information between the processor and external devices. The communication interface of the computer device is configured to perform wired or wireless communication with external terminals. The wireless communication can be achieved through WIFI, mobile cellular network, near field communication (NFC), or other technologies. The computer program is executed by the processor to implement a data query method. The display unit of the computer device is configured to form a visually visible picture, which can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer overlaid on the display screen, or a key, trackball, or touchpad arranged on the shell of the computer device. The input device can also be an external keyboard, touchpad, or mouse, etc.

[0122] Those skilled in the art can understand that, Figure 5The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0123] In an embodiment, a computer device is provided, including a memory and a processor, the memory storing a computer program, and the processor implementing the steps in the above method embodiments when executing the computer program.

[0124] In an embodiment, a computer readable storage medium is provided, storing a computer program, and the computer program implementing the steps in the above method embodiments when executed by a processor.

[0125] In an embodiment, a computer program product is provided, including a computer program, and the computer program implementing the steps in the above method embodiments when executed by a processor.

[0126] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant regulations.

[0127] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when executed, can include the processes of the above-mentioned embodiment methods. Any reference to memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. The non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical storage, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. The volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration but not limitation, the RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The database involved in the embodiments provided in the present application can include at least one of a relational database and a non-relational database. The non-relational database can include a distributed database based on a block chain, etc., without being limited thereto. The processor involved in the embodiments provided in the present application can be a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., without being limited thereto.

[0128] The technical features of the above embodiments can be combined in any manner. To make the description concise, all possible combinations of the technical features in the above embodiments are not described, but as long as the combinations of the technical features do not exist contradictions, they should be considered as the scope of the present application.

[0129] The above-described embodiments are merely illustrative of several embodiments of the present application, which are described in more detail and in a specific manner, but should not be construed as limiting the scope of the patent of the present application. It should be noted that, for those of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.

Claims

1. A data query method, characterized by, The method comprises: displaying a data query page; the data query page is provided with a first query mode and a second query mode at the same time, the first query mode comprises searching in a database storing business data, and the second query mode comprises searching in a data shard corresponding to the business data through a search engine; the search engine is used for updating the data shard according to an update frequency of the data shard; According to the data query operation of triggering a request to query target data in the data query page, the query condition of the target data is obtained; if the query condition is a time search range corresponding to the target data, the update frequency of the data shard related to the target data in the search engine is obtained; in the case where it is determined according to the update frequency that the data shard related to the target data in the time search range has not been updated, the first query mode is taken as a recommended query mode; in the case where it is determined according to the update frequency that the data shard related to the target data in the time search range has been updated, the second query mode is taken as a recommended query mode; a target query mode is determined based on the recommended query mode; the target query mode is the first query mode or the second query mode; An interface corresponding to the target query mode is called to query the target data through the target query mode.

2. The method of claim 1, wherein, The calling of the interface corresponding to the target query mode comprises: if the target query mode is the first query mode, a query condition adding prompt is displayed, and the query condition adding prompt is used to prompt a user to add other query conditions in addition to the time search range; The added other query conditions are received, an interface calling request containing the time search range and the other query conditions is generated, and the interface calling request is sent to an interface corresponding to the first query mode.

3. The method of claim 1, wherein, The method further comprises: if the query condition comprises a plurality of query conditions, a query speed comparison result of the first query mode and the second query mode under the plurality of query conditions is predicted; According to the query speed comparison result, a recommended query mode is determined from the first query mode and the second query mode.

4. The method of claim 3, wherein, The prediction of the query speed comparison result of the first query mode and the second query mode under the plurality of query conditions comprises: a pre-trained query speed prediction model is called, the plurality of query conditions are input into the query speed prediction model, and the query speed comparison result of the first query mode and the second query mode is obtained; The query speed prediction model is trained based on a sample query condition set and a query speed label, and the query speed label represents a query speed comparison result of the first query mode and the second query mode when data query is performed based on a plurality of sample query conditions in the sample query condition set.

5. A data query apparatus, characterized by comprising: The device comprises: The page display module is configured to display a data query page, wherein the data query page is provided with a first query mode and a second query mode, the first query mode comprises searching in a database storing business data, and the second query mode comprises searching in a data shard corresponding to the business data through a search engine; and the search engine is configured to update the data shard according to an update frequency of the data shard. The target query mode determination module is configured to acquire a query condition of target data according to a data query operation of requesting to query the target data in the data query page; if the query condition is a time search range corresponding to the target data, acquire an update frequency of a data shard related to the target data in the search engine; if it is determined according to the update frequency that the data shard related to the target data in the time search range is not updated, set the first query mode as a recommended query mode; if it is determined according to the update frequency that the data shard related to the target data in the time search range is updated, set the second query mode as the recommended query mode; and determine a target query mode based on the recommended query mode, wherein the target query mode is the first query mode or the second query mode. The data query module is configured to call an interface corresponding to the target query mode to query the target data through the target query mode. 6.A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the computer device is configured to perform the method according to any one of claims 1-5 when the computer program is executed by the processor. The computer program is executed by the processor to implement the steps of the method of any one of claims 1 to 4.

7. A computer readable storage medium having stored thereon a computer program, characterized in that The computer program is executed by the processor to implement the steps of the method of any one of claims 1 to 4.

8. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method of any one of claims 1 to 4.

Citation Information

Patent Citations

  • Mass data quick query method based on polymorphic composition

    CN110489445A

  • Real-time object storage query system based on search engine and relational database

    CN116204556A