[go: up one dir, main page]

CN114490719A - Data query method and device, electronic equipment and storage medium - Google Patents

Data query method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114490719A
CN114490719A CN202210143806.0A CN202210143806A CN114490719A CN 114490719 A CN114490719 A CN 114490719A CN 202210143806 A CN202210143806 A CN 202210143806A CN 114490719 A CN114490719 A CN 114490719A
Authority
CN
China
Prior art keywords
query
data
interception
logic
target data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210143806.0A
Other languages
Chinese (zh)
Inventor
王凯
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN202210143806.0A priority Critical patent/CN114490719A/en
Publication of CN114490719A publication Critical patent/CN114490719A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2428Query predicate definition using graphical user interfaces, including menus and forms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation

Landscapes

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

Abstract

本申请实施例公开了一种数据查询方法、装置、电子设备以及存储介质,应用于计算机技术领域。该方法可以包括:接收第一客户端发送的第一查询请求,第一查询请求携带请求查询的查询范围信息;若查询范围信息满足目标条件,确定第一查询逻辑,第一查询逻辑用于指示K个维度的截取条件的信息,K为正整数;获取同时满足K个维度的截取条件的第一查询请求所指示查询的第一数据;若第一数据的数据量大于或等于目标数据量,从第一数据中选取目标数据量的第一目标数据,并将第一目标数据返回至第一客户端。通过本方法实施例可以有助于减少数据查询的响应时间。本申请实施例还可以应用于区块链技术领域中,如根据查询逻辑从区块链中获取数据。

Figure 202210143806

The embodiments of the present application disclose a data query method, device, electronic device, and storage medium, which are applied in the field of computer technology. The method may include: receiving a first query request sent by a first client, where the first query request carries query scope information of the requested query; if the query scope information satisfies a target condition, determining a first query logic, where the first query logic is used to indicate Information about the interception conditions of K dimensions, K is a positive integer; obtain the first data queried by the first query request that satisfies the interception conditions of K dimensions at the same time; if the data volume of the first data is greater than or equal to the target data volume, The first target data of the target data amount is selected from the first data, and the first target data is returned to the first client. The method embodiment can help reduce the response time of data query. The embodiments of the present application can also be applied in the field of blockchain technology, such as obtaining data from the blockchain according to query logic.

Figure 202210143806

Description

一种数据查询方法、装置、电子设备以及存储介质A data query method, device, electronic device and storage medium

技术领域technical field

本申请涉及计算机技术领域,尤其涉及一种数据查询方法、装置、电子设备以及存储介质。The present application relates to the field of computer technology, and in particular, to a data query method, apparatus, electronic device, and storage medium.

背景技术Background technique

随着计算机技术的高速发展,在一些应用场景中,用户通常需要查询大量的数据,如管理人员查询下属员工的资料信息等等。目前在处理数据查询请求时,通常是根据查询请求一次性查询出该查询请求所对应的全部数据量,以返回至对应的客户端进行显示,若需要查询的数据的数据量较多,则获取数据所需要的时间更多,甚至可能使服务器出现堵塞或者内存溢出现象,进而导致数据查询的响应时间较长,查询性能较低。With the rapid development of computer technology, in some application scenarios, users usually need to query a large amount of data, such as managers querying the information of subordinate employees and so on. At present, when processing a data query request, the entire data volume corresponding to the query request is usually queried at one time according to the query request, and returned to the corresponding client for display. If the data volume to be queried is large, the Data requires more time, and may even cause server blockage or memory overflow, which in turn leads to longer data query response time and lower query performance.

发明内容SUMMARY OF THE INVENTION

本申请实施例提供了一种数据查询方法、装置、电子设备以及存储介质,有助于减少数据查询的响应时间。The embodiments of the present application provide a data query method, apparatus, electronic device, and storage medium, which help to reduce the response time of data query.

一方面,本申请实施例公开了一种数据查询方法,所述方法包括:On the one hand, the embodiment of the present application discloses a data query method, the method includes:

接收第一客户端发送的第一查询请求,所述第一查询请求携带请求查询的查询范围信息;receiving a first query request sent by a first client, where the first query request carries the query scope information of the requested query;

若所述查询范围信息满足目标条件,确定第一查询逻辑,所述第一查询逻辑用于指示K个维度的截取条件的信息,K为正整数;If the query range information satisfies the target condition, determine the first query logic, where the first query logic is used to indicate the information of the interception conditions of K dimensions, where K is a positive integer;

获取同时满足所述K个维度的截取条件的所述第一查询请求所指示查询的第一数据;obtaining the first data queried by the first query request that simultaneously satisfies the interception conditions of the K dimensions;

若所述第一数据的数据量大于或等于目标数据量,从所述第一数据中选取所述目标数据量的第一目标数据,并将所述第一目标数据返回至所述第一客户端。If the data volume of the first data is greater than or equal to the target data volume, select the first target data of the target data volume from the first data, and return the first target data to the first client end.

另一方面,本申请实施例公开了一种数据查询装置,所述装置包括:On the other hand, an embodiment of the present application discloses a data query device, and the device includes:

接收单元,用于接收第一客户端发送的第一查询请求,所述第一查询请求携带请求查询的查询范围信息;a receiving unit, configured to receive a first query request sent by a first client, where the first query request carries query range information of the requested query;

处理单元,用于若所述查询范围信息满足目标条件,确定第一查询逻辑,所述第一查询逻辑用于指示K个维度的截取条件的信息,K为正整数;a processing unit, configured to determine a first query logic if the query range information satisfies the target condition, where the first query logic is used to indicate the information of the interception conditions of K dimensions, where K is a positive integer;

获取单元,用于获取同时满足所述K个维度的截取条件的所述第一查询请求所指示查询的第一数据;an obtaining unit, configured to obtain the first data queried by the first query request that simultaneously satisfies the interception conditions of the K dimensions;

所述处理单元,还用于若所述第一数据的数据量大于或等于目标数据量,从所述第一数据中选取所述目标数据量的第一目标数据,并将所述第一目标数据返回至所述第一客户端。The processing unit is further configured to select the first target data of the target data volume from the first data if the data volume of the first data is greater than or equal to the target data volume, and convert the first target data to the target data volume. Data is returned to the first client.

又一方面,本申请实施例提供了一种电子设备,电子设备包括处理器、存储器,其中,所述存储器用于存储计算机程序,所述计算机程序包括程序指令,所述处理器被配置用于执行如下步骤:In another aspect, an embodiment of the present application provides an electronic device, the electronic device includes a processor and a memory, wherein the memory is used to store a computer program, the computer program includes program instructions, and the processor is configured to Perform the following steps:

接收第一客户端发送的第一查询请求,所述第一查询请求携带请求查询的查询范围信息;receiving a first query request sent by a first client, where the first query request carries the query scope information of the requested query;

若所述查询范围信息满足目标条件,确定第一查询逻辑,所述第一查询逻辑用于指示K个维度的截取条件的信息,K为正整数;If the query range information satisfies the target condition, determine the first query logic, where the first query logic is used to indicate the information of the interception conditions of K dimensions, where K is a positive integer;

获取同时满足所述K个维度的截取条件的所述第一查询请求所指示查询的第一数据;obtaining the first data queried by the first query request that simultaneously satisfies the interception conditions of the K dimensions;

若所述第一数据的数据量大于或等于目标数据量,从所述第一数据中选取所述目标数据量的第一目标数据,并将所述第一目标数据返回至所述第一客户端。If the data volume of the first data is greater than or equal to the target data volume, select the first target data of the target data volume from the first data, and return the first target data to the first client end.

又一方面,本申请实施例提供了一种计算机可读存储介质,计算机可读存储介质中存储有计算机程序指令,计算机程序指令被处理器执行时,用于执行如下步骤:In another aspect, an embodiment of the present application provides a computer-readable storage medium, where computer program instructions are stored in the computer-readable storage medium, and when the computer program instructions are executed by a processor, are used to perform the following steps:

接收第一客户端发送的第一查询请求,所述第一查询请求携带请求查询的查询范围信息;receiving a first query request sent by a first client, where the first query request carries the query scope information of the requested query;

若所述查询范围信息满足目标条件,确定第一查询逻辑,所述第一查询逻辑用于指示K个维度的截取条件的信息,K为正整数;If the query range information satisfies the target condition, determine the first query logic, where the first query logic is used to indicate the information of the interception conditions of K dimensions, where K is a positive integer;

获取同时满足所述K个维度的截取条件的所述第一查询请求所指示查询的第一数据;obtaining the first data queried by the first query request that simultaneously satisfies the interception conditions of the K dimensions;

若所述第一数据的数据量大于或等于目标数据量,从所述第一数据中选取所述目标数据量的第一目标数据,并将所述第一目标数据返回至所述第一客户端。If the data volume of the first data is greater than or equal to the target data volume, select the first target data of the target data volume from the first data, and return the first target data to the first client end.

又一方面,本申请实施例公开了一种计算机程序产品或计算机程序,所述计算机程序产品或计算机程序包括计算机指令,所述计算机指令存储在计算机可读存储介质中。计算机设备的处理器从计算机可读存储介质读取所述计算机指令,处理器执行所述计算机指令,使得所述计算机设备执行上述数据查询方法。In another aspect, the embodiments of the present application disclose a computer program product or computer program, where the computer program product or computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the above data query method.

本申请实施例能够在检测到查询请求中的查询范围信息满足目标条件时,确定对应的查询逻辑以截取同时满足所述K个维度的截取条件的第一数据,由此可以仅获取查询请求所指示查询的数据中的部分数据,进而从第一数据中确定出目标数据量的数据返回至对应的客户端。由于获取部分数据所需花费的时间相较于获取查询请求所指示查询的全部数据来说,所需花费的时间更少,由此有助于减少数据查询的响应时间。In the embodiment of the present application, when it is detected that the query range information in the query request satisfies the target condition, the corresponding query logic is determined to intercept the first data that simultaneously satisfies the interception conditions of the K dimensions, so that only the information in the query request can be obtained. Indicate part of the data in the queried data, and then return the data of the target data amount from the first data to the corresponding client. Since the time required to acquire part of the data is less than the time required to acquire all the data queried indicated by the query request, the response time of the data query can be reduced.

附图说明Description of drawings

为了更清楚地说明本申请实施例技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to explain the technical solutions of the embodiments of the present application more clearly, the following briefly introduces the accompanying drawings used in the description of the embodiments. For those of ordinary skill, other drawings can also be obtained from these drawings without any creative effort.

图1是本申请实施例提供的一种数据查询系统的结构示意图;1 is a schematic structural diagram of a data query system provided by an embodiment of the present application;

图2是本申请实施例提供的一种数据查询方法的流程示意图;2 is a schematic flowchart of a data query method provided by an embodiment of the present application;

图3是本申请实施例提供的一种数据查询方法的流程示意图;3 is a schematic flowchart of a data query method provided by an embodiment of the present application;

图4是本申请实施例提供的一种数据查询方法的流程示意图;4 is a schematic flowchart of a data query method provided by an embodiment of the present application;

图5是本申请实施例提供的一种数据查询装置的结构示意图;5 is a schematic structural diagram of a data query apparatus provided by an embodiment of the present application;

图6是本申请实施例提供的一种电子设备的结构示意图。FIG. 6 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.

具体实施方式Detailed ways

下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.

本申请提供一种数据查询方案,能够在检测到查询请求中的查询范围信息满足目标条件时,确定对应的查询逻辑以截取同时满足所述K个维度的截取条件的第一数据,由此可以仅获取查询请求所指示查询的数据中的部分数据,进而从第一数据中确定出目标数据量的数据返回至对应的客户端。由于获取部分数据所需花费的时间相较于获取查询请求所指示查询的全部数据来说,所需花费的时间更少,由此有助于减少数据查询的响应时间。The present application provides a data query solution, which can determine the corresponding query logic to intercept the first data that simultaneously satisfies the interception conditions of the K dimensions when it is detected that the query range information in the query request satisfies the target condition. Only a part of the data in the data queried indicated by the query request is acquired, and then the data of the target data amount determined from the first data is returned to the corresponding client. Since the time required to acquire part of the data is less than the time required to acquire all the data queried indicated by the query request, the response time of the data query can be reduced.

在一种可能的实施方式中,本申请实施例可以应用于一种数据查询系统。请参见图1,图1是本申请实施例提供的一种数据查询系统的结构示意图,该数据查询系统可包括客户端以及数据查询服务器。其中,该数据查询服务器可以配置有上述数据查询方案。该数据查询服务器可以接收来源于各个客户端的至少一次查询请求。该查询请求为用于查询数据的请求。针对相同查询目的的查询请求,数据处理服务器可以根据处理每次查询请求所对应的查询响应时间对处理下一次查询请求时所采用的查询逻辑进行确定,如果查询响应时间大于响应时间阈值,则可以对处理下一次查询请求时所采用的查询逻辑所对应的查询逻辑进行调整;如果查询响应时间小于或等于响应时间阈值,则可以不对处理下一次查询请求时所采用的查询逻辑所对应的查询逻辑进行调整。其中,上述查询目的用于指示查询请求用于查询何种数据,例如,该查询目的可以为查询人员信息、查询交易记录、查询文件目录、查询含有目标关键字的文档等等,此处不做限制。该查询响应时间用于指示接收到查询请求的时间与向客户端返回数据的时间之间的时间差。由此可以根据每次的查询请求的查询逻辑对下一次查询请求的查询逻辑进行调整以找到能够使得查询响应时间小于响应时间阈值的查询逻辑,相当于确定了一个较优秀的查询逻辑,进而后续都可以按照这个优秀的查询逻辑对查询请求进行处理,从而保障查询请求的查询性能,使得数据查询服务器在较少的查询响应时间内向客户端返回查询到的数据。In a possible implementation, the embodiments of the present application may be applied to a data query system. Please refer to FIG. 1. FIG. 1 is a schematic structural diagram of a data query system provided by an embodiment of the present application. The data query system may include a client and a data query server. The data query server may be configured with the above data query scheme. The data query server may receive at least one query request from each client. The query request is a request for querying data. For query requests with the same query purpose, the data processing server can determine the query logic used in processing the next query request according to the query response time corresponding to each query request. If the query response time is greater than the response time threshold, it can Adjust the query logic corresponding to the query logic used in processing the next query request; if the query response time is less than or equal to the response time threshold, the query logic corresponding to the query logic used in processing the next query request may not be processed make adjustments. The above query purpose is used to indicate what kind of data the query request is used to query. For example, the query purpose may be querying personnel information, querying transaction records, querying file directories, querying documents containing target keywords, etc. limit. The query response time is used to indicate the time difference between the time when the query request is received and the time when the data is returned to the client. In this way, the query logic of the next query request can be adjusted according to the query logic of each query request to find the query logic that can make the query response time less than the response time threshold, which is equivalent to determining a better query logic, and then follow-up The query request can be processed according to this excellent query logic, so as to ensure the query performance of the query request, so that the data query server can return the queried data to the client in less query response time.

该客户端可以用于向上述数据查询服务器发送查询请求,客户端通过该查询请求可以获取到对应的查询结果。在一种可能的场景中,用户在需要查询数据时,可以在客户端中点击用于指示查询一定数据的控件,如企业的管理人员点击用于查询下属员工信息的控件;或者,在客户端中输入需要查询的数据的范围后点击用于指示开始查询的控件,如用户在查询人员的交易记录时输入需要查询的人员(如某个小组的全部人员)以及时间范围(如近3个月),然后用户点击“查询”控件。进而客户端在检测到点击用于指示查询一定数据的控件或点击用于指示开始查询的控件时,向上述数据查询服务器发送查询请求以获取对应的查询结果。The client can be used to send a query request to the above-mentioned data query server, and the client can obtain the corresponding query result through the query request. In a possible scenario, when a user needs to query data, they can click a control on the client to instruct to query certain data, for example, an enterprise manager clicks on a control for querying subordinate employee information; or, on the client After entering the range of data to be queried, click the control used to indicate the start of the query. For example, when the user is querying the transaction records of the personnel, he enters the personnel to be queried (such as all personnel in a group) and the time range (such as the past 3 months). ), then the user clicks the Query control. Further, the client sends a query request to the above-mentioned data query server to obtain the corresponding query result when detecting that the control for instructing to query certain data or the control for instructing to start the query is clicked.

客户端在显示查询请求对应的查询结果时,可以分页进行显示,每页显示目标数据量的数据。该目标数据量用于指示客户端中一页能够显示的数据量。数据量用于指示数据的多少,也就是数据的条数。例如,查询请求的查询目的为查询交易记录,则数据量表示有多少条交易记录;又如,查询请求的查询目的为查询人员信息,则数据量表示有多少条人员信息,即有多少个人员的信息。由此本方案的数据查询服务器在根据查询逻辑获取一次数据后,若获取到的数据大于目标数据量,需要从查询到的数据中选取目标数据量的数据返回至客户端,以便于客户端刚好显示一页数据。例如,客户端中每页可以显示20条数据,数据查询服务器根据查询请求对应的查询逻辑获取到25条数据,则可以从25条数据中选取20条数据返回至客户端中,以便于客户端显示第一页的数据。When the client displays the query result corresponding to the query request, it can be displayed in pages, and each page displays the data of the target data volume. The target data amount is used to indicate the amount of data that can be displayed on a page in the client. The amount of data is used to indicate the amount of data, that is, the number of pieces of data. For example, if the query purpose of the query request is to query transaction records, the data volume indicates how many transaction records there are; for another example, if the query purpose of the query request is to query personnel information, the data volume indicates how many pieces of personnel information there are, that is, how many personnel there are. Information. Therefore, after the data query server of this solution obtains data once according to the query logic, if the obtained data is larger than the target data volume, it needs to select the target data volume from the queried data and return it to the client, so that the client can just Display a page of data. For example, each page in the client can display 20 pieces of data, and the data query server obtains 25 pieces of data according to the query logic corresponding to the query request, then 20 pieces of data can be selected from the 25 pieces of data and returned to the client, so as to facilitate the client Displays the first page of data.

需要特别说明的是,除特别说明外,在本申请的具体实施方式中,涉及到人员信息、用户信息等相关的数据,当本申请的实施例运用到具体产品或技术中时,均需要获得用户许可或者同意,且相关数据的收集、使用和处理需要遵守相关国家和地区的相关法律法规和标准。It should be noted that, unless otherwise specified, in the specific implementation of this application, data related to personnel information, user information, etc. are involved. When the embodiments of this application are applied to specific products or technologies, it is necessary to obtain User permission or consent, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.

该本申请的技术方案可运用在电子设备中,该电子设备可以是终端,也可以是服务器,或者也可以是用于进行数据查询的其他设备,本申请不做限定。可选的。服务器可以是独立的物理服务器,也可以是多个物理服务器构成的服务器集群或者分布式系统,还可以是提供云服务、云数据库、云计算、云存储、网络服务、中间件服务、以及大数据和人工智能平台等基础云计算服务的云服务器。终端可以是智能手机、平板电脑、笔记本电脑、台式计算机等,但并不局限于此。The technical solution of the present application can be applied to an electronic device, and the electronic device can be a terminal, a server, or other devices used for data query, which is not limited in this application. optional. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or it can provide cloud services, cloud databases, cloud computing, cloud storage, network services, middleware services, and big data. Cloud servers for basic cloud computing services such as artificial intelligence platforms. The terminal may be a smart phone, a tablet computer, a notebook computer, a desktop computer, etc., but is not limited thereto.

基于上述的描述,本申请实施例提出一种数据查询方法。请参见图2,图2是本申请实施例提供的一种数据查询方法的流程示意图。该方法可以由上述所提及的电子设备执行。该数据查询方法可以包括以下步骤。Based on the above description, an embodiment of the present application proposes a data query method. Please refer to FIG. 2, which is a schematic flowchart of a data query method provided by an embodiment of the present application. The method may be performed by the electronic device mentioned above. The data query method may include the following steps.

S201、接收第一客户端发送的第一查询请求。S201. Receive a first query request sent by a first client.

其中,该第一查询请求为任一用于查询数据的请求,该第一查询请求携带请求查询的查询范围信息。该查询范围信息可以为查询请求所指示需要查询的数据的范围。例如,在查询人员的交易明细数据时,该查询范围信息可以指示需要查询人员范围(如某个小组的全部人员、某个人),需要查询的时间范围(如近3个月、近一个月等等),或者其他限定查询范围的信息,此处不做限制。在一种可能的实施方式中,该查询范围信息可以根据用户在客户端输入的需要查询的数据的范围进行确定,也可以根据用户所点击的用于指示查询一定数据的控件后,该控件所默认的查询范围所确定,此处不做限制。Wherein, the first query request is any request for querying data, and the first query request carries query scope information of the requested query. The query scope information may be the scope of the data to be queried indicated by the query request. For example, when querying the transaction details data of a person, the query scope information may indicate the scope of the personnel to be queried (such as all personnel of a certain group, a certain person), and the time range to be queried (such as the last 3 months, the last month, etc. etc.), or other information that limits the scope of the query, which is not limited here. In a possible implementation manner, the query range information may be determined according to the range of data to be queried input by the user at the client, or may be determined according to the control clicked by the user for instructing to query certain data, the control It is determined by the default query scope, which is not limited here.

S202、若查询范围信息满足目标条件,确定第一查询逻辑。S202. If the query scope information satisfies the target condition, determine the first query logic.

其中,该目标条件可以为用于触发确定第一查询逻辑的条件。该目标条件可以为针对各种维度的查询范围的条件。例如,该目标条件可以包括人员范围所指示的人员数量大于人员预设值,还可以包括时间范围大于时间预设值,还可以包括针对其他限定查询范围的条件等等。例如,在查询人员的交易明细数据时,该目标条件可以为人员范围所指示的人数大于或等于20人,且时间范围大于或等于3个月。Wherein, the target condition may be a condition for triggering the determination of the first query logic. The target condition may be the condition of the query range for various dimensions. For example, the target condition may include that the number of personnel indicated by the personnel scope is greater than the preset value of personnel, may also include that the time scope is greater than the preset time value, and may also include other conditions for limiting the query scope, and so on. For example, when querying the transaction detail data of a person, the target condition may be that the number of people indicated by the personnel range is greater than or equal to 20, and the time range is greater than or equal to 3 months.

若查询范围信息不满足目标条件,则可以不确定出第一查询逻辑,而是直接获取第一查询请求所请求查询的全部数据。可以理解的是,若查询范围信息不满足目标条件,则表示第一查询请求所指示查询的数据的数据量较少,则可以不根据第一查询逻辑来获取数据,即不需要通过第一查询逻辑来减少查询响应时间,直接获取查询请求所指示查询的全部数据的时间也不会太多,由此可以有针对性地确定是否确定第一查询逻辑,避免对需要查询的数据量较小的查询请求也进行数据的截取,反倒造成查询响应时间地增加。If the query range information does not meet the target condition, the first query logic may not be determined, but all the data queried by the first query request may be directly obtained. It can be understood that if the query scope information does not meet the target condition, it means that the data amount of the data queried indicated by the first query request is small, and the data may not be obtained according to the first query logic, that is, it is not necessary to pass the first query. Logic to reduce the query response time, and it will not take too much time to directly obtain all the data queried by the query request. Therefore, it can be determined whether to determine the first query logic in a targeted manner, avoiding the need for a small amount of data to be queried. The query request also intercepts the data, which causes the query response time to increase.

该第一查询逻辑用于指示K个维度的截取条件的信息,K为正整数。其中,该K个维度的截取条件用于指示数据查询服务器在获取数据时需要截取哪些数据。该K个维度用于指示截取条件所针对的维度。例如,第一查询请求用于指示查询人员的交易明细数据,则该K个维度可以包括针对人员范围所指示的人员数量这一维度,对应的截取条件如可以为人员数量=3,则限定查询范围的可以截取3个人员的交易明细数据;该K个维度还可以包括时间范围这一维度,对应的截取条件如可以为时间范围=3天,则限定查询范围的可以截取3天的交易明细数据;或者,该K个维度还可以包括其他维度,此处不做限制。The first query logic is used to indicate the information of the interception conditions of K dimensions, where K is a positive integer. The interception conditions of the K dimensions are used to indicate which data the data query server needs to intercept when acquiring data. The K dimensions are used to indicate the dimensions for which the truncation condition is directed. For example, if the first query request is used to indicate the transaction details of the query personnel, the K dimensions may include the dimension of the number of personnel indicated for the scope of personnel, and the corresponding interception condition may be the number of personnel = 3, then the query is limited The transaction details data of 3 people can be intercepted in the range; the K dimensions can also include the dimension of time range. If the corresponding interception condition can be time range=3 days, the transaction details of 3 days can be intercepted in the limited query range. data; or, the K dimensions may also include other dimensions, which are not limited here.

S203、获取同时满足K个维度的截取条件的第一查询请求所指示查询的第一数据。S203: Obtain the first data queried by the first query request that simultaneously satisfies the interception conditions of K dimensions.

其中,该第一数据可以为第一查询请求所指示查询的同时满足K个维度的截取条件的数据。例如,在查询人员的交易明细数据时,第一查询请求所指示查询范围为人员数量为20人,时间范围为3个月,该K个维度的截取条件包括:人员数量=3以及时间范围=3天,则可以先获取3个人员在3天内的交易明细数据作为上述第一数据。在一种可能的实施方式中,在获取满足K个维度的截取条件的数据时,可以根据对应维度的一定顺序或者随机确定满足截取条件的数据。例如,在上述获取3个人员在3天内的交易明细数据时,可以根据随机获取任意3个人员在任意3天的交易明细数据作为第一数据;或者,也可以根据人员的人员编码排序以及时间与当前时间的距离的远近,来确定出人员编码排序靠前的3个人员在时间与当前时间的距离最近(或最远)的3天的交易记录数据作为第一数据。The first data may be data that satisfies the interception conditions of K dimensions while being queried as indicated by the first query request. For example, when querying the transaction details data of a person, the first query request indicates that the query range is 20 people and the time range is 3 months. The interception conditions of the K dimensions include: the number of people=3 and the time range= 3 days, you can first obtain the transaction details data of 3 personnel within 3 days as the above-mentioned first data. In a possible implementation manner, when acquiring data satisfying the interception conditions of K dimensions, the data satisfying the interception conditions may be determined according to a certain order of corresponding dimensions or randomly. For example, when obtaining the detailed transaction data of 3 personnel within 3 days above, the transaction detailed data of any 3 personnel within any 3 days can be obtained randomly as the first data; or, it can also be sorted according to the personnel code and time of the personnel. The distance from the current time is used to determine the transaction record data of the three days with the closest (or farthest) distance between the time and the current time for the three personnel in the top ranking of the personnel code as the first data.

S204、若第一数据的数据量大于或等于目标数据量,从第一数据中选取目标数据量的第一目标数据,并将第一目标数据返回至第一客户端。S204. If the data volume of the first data is greater than or equal to the target data volume, select first target data of the target data volume from the first data, and return the first target data to the first client.

其中,如上述,目标数据量用于指示第一客户端一页能够显示数据量,此处不做赘述。该第一目标数据即为第一查询请求所对应的需要返回至第一客户端中在同一页数据中进行显示的数据。例如,当第一数据的数据量为25条,目标数据量为20条,则可以从第一数据中选取20条数据作为第一目标数据,以将第一目标数据返回至第一客户端。在一种可能的实施方式中,在从第一数据中选取目标数据量的第一目标数据时,可以从第一数据中随机选择,也可以按照一定顺序从第一数据中选择。例如,第一数据为3个人员在3天内的交易记录数据,则可以按照人员的人员编码排序以及数据对应的时间与当前时间远近进行选取目标数据量的数据,如优先选取人员编码排序靠前的人员的交易明细数据,对同一人员的交易明细数据则优先选取交易发生时间与当前时间最近的交易明细数据,由此得到第一目标交易数据。Wherein, as described above, the target data amount is used to indicate the amount of data that can be displayed on one page of the first client, and details are not described here. The first target data is the data corresponding to the first query request that needs to be returned to the first client and displayed in the same page of data. For example, when the data volume of the first data is 25 and the target data volume is 20, then 20 pieces of data can be selected from the first data as the first target data to return the first target data to the first client. In a possible implementation manner, when the first target data of the target data volume is selected from the first data, it may be randomly selected from the first data, or may be selected from the first data in a certain order. For example, if the first data is the transaction record data of 3 people within 3 days, the data of the target data volume can be selected according to the personnel code sorting of the personnel and the time corresponding to the data and the current time. For the transaction details data of the same person, the transaction details data with the transaction occurrence time closest to the current time are preferentially selected, thereby obtaining the first target transaction data.

本申请实施例能够在检测到查询请求中的查询范围信息满足目标条件时,确定对应的查询逻辑以截取同时满足所述K个维度的截取条件的第一数据,由此可以仅获取查询请求所指示查询的数据中的部分数据,进而从第一数据中确定出目标数据量的数据返回至对应的客户端。由于获取部分数据所需花费的时间相较于获取查询请求所指示查询的全部数据来说,所需花费的时间更少,由此有助于减少数据查询的响应时间。In the embodiment of the present application, when it is detected that the query range information in the query request satisfies the target condition, the corresponding query logic is determined to intercept the first data that simultaneously satisfies the interception conditions of the K dimensions, so that only the information in the query request can be obtained. Indicate part of the data in the queried data, and then return the data of the target data amount from the first data to the corresponding client. Since the time required to acquire part of the data is less than the time required to acquire all the data queried indicated by the query request, the response time of the data query can be reduced.

请参见图3,图3是本申请实施例提供的一种数据查询方法的流程示意图,该方法可以由上述所提及的电子设备执行。该数据查询方法可以包括以下步骤。Please refer to FIG. 3. FIG. 3 is a schematic flowchart of a data query method provided by an embodiment of the present application, and the method may be executed by the aforementioned electronic device. The data query method may include the following steps.

S301、接收第一客户端发送的第一查询请求。S301. Receive a first query request sent by a first client.

S302、若查询范围信息满足目标条件,确定第一查询逻辑。S302. If the query range information satisfies the target condition, determine the first query logic.

在一种可能的实施方式中,如上述,数据处理服务器可以根据处理每次查询请求所对应的查询响应时间对处理下一次查询请求时所采用的查询逻辑进行确定,则确定第一查询逻辑的方法可以为根据第一查询请求前最近一次完成查询且满足目标条件的查询请求进行确定。其中,完成查询用于指示数据查询服务器在向对应的客户端返回数据。In a possible implementation manner, as described above, the data processing server may determine the query logic used in processing the next query request according to the query response time corresponding to processing each query request, and then determine the query logic of the first query logic. The method may be the determination according to the query request that completed the query last time before the first query request and satisfies the target condition. The query completion is used to indicate that the data query server is returning data to the corresponding client.

在一种可能的实施方式中,确定第一查询逻辑之前可以包括以下步骤:①接收第二客户端发送的第二查询请求,确定第二查询逻辑。其中,第二查询请求为第一查询请求前最近一次完成查询且满足目标条件的查询请求,第二查询逻辑用于指示N个维度的截取条件的信息,N为正整数。可以理解的是,N小于或等于K,该第二查询请求与第一查询请求的查询目的相同,但是所查询的数据量可以不同,如第一查询请求用于查询20个人员在3个月内的交易明细数据,第二查询请求可以用于查询25个人在1个月内的交易明细数据。②根据第二查询逻辑确定出对应的第二目标数据,并将第二目标数据返回至第二客户端。其中,此处的步骤②可以参照步骤S203-S204的相关描述,也就是,获取同时满足该N个维度的截取条件的第二查询请求所指示查询的第四数据;若该第四数据的数据量大于或等于目标数据量,从第四数据中选取目标数据量的第二目标数据,并将第二目标数据返回至第一客户端。其中,该第四数据即为第二查询请求所指示查询的同时满足N个维度的截取条件的数据,该第二目标数据即为第二查询请求所对应的需要返回至第一客户端中在同一页数据中进行显示的数据。③记录第二查询请求所对应的查询响应时间。其中,查询响应时间用于指示接收到第二查询请求的时间与向第二客户端返回第二目标数据的时间之间的时间差。例如,数据查询服务器接收到第二查询请求的时间为t1,向第二客户端返回第二目标数据的时间为t2,则第二查询请求的查询响应时间可以为t2-t1。由此可以通过该查询响应时间来作为查询请求的查询性能的判断标准,若查询响应时间越小,则表示查询性能越好,若查询响应时间越大,则表示查询性能越差,通过记录查询响应时间,可以来确定查询性能是否满足预设条件。In a possible implementation manner, before determining the first query logic, the following steps may be included: ① Receive a second query request sent by the second client, and determine the second query logic. Wherein, the second query request is a query request that has completed the last query before the first query request and satisfies the target condition, and the second query logic is used to indicate the information of the interception conditions of N dimensions, where N is a positive integer. It can be understood that, if N is less than or equal to K, the second query request has the same query purpose as the first query request, but the amount of data queried can be different. For example, the first query request is used to query 20 people within 3 months. The transaction details data within the second query request can be used to query the transaction details data of 25 individuals within one month. ② Determine the corresponding second target data according to the second query logic, and return the second target data to the second client. Wherein, step ② here can refer to the relevant descriptions of steps S203-S204, that is, obtain the fourth data queried by the second query request that satisfies the interception conditions of the N dimensions at the same time; if the data of the fourth data If the amount is greater than or equal to the target data amount, second target data of the target data amount is selected from the fourth data, and the second target data is returned to the first client. Wherein, the fourth data is the data that meets the interception conditions of N dimensions while being queried by the second query request, and the second target data is the data corresponding to the second query request that needs to be returned to the first client. Data displayed on the same page of data. ③ Record the query response time corresponding to the second query request. The query response time is used to indicate the time difference between the time when the second query request is received and the time when the second target data is returned to the second client. For example, if the time when the data query server receives the second query request is t1, and the time when it returns the second target data to the second client is t2, the query response time of the second query request may be t2-t1. Therefore, the query response time can be used as the judgment criterion for the query performance of the query request. If the query response time is shorter, the query performance is better. If the query response time is longer, the query performance is worse. The response time can be used to determine whether the query performance meets the preset conditions.

进而,确定第一查询逻辑的方式可以为:根据第二查询请求所对应的查询响应时间以及第二查询逻辑确定第一查询逻辑。Furthermore, the manner of determining the first query logic may be: determining the first query logic according to the query response time corresponding to the second query request and the second query logic.

具体的,若第二查询请求所对应的查询响应时间大于响应时间阈值,则将第二查询逻辑确定为第一查询逻辑。该响应时间阈值用于指示将第二查询逻辑确定为第一查询逻辑最大值,若第二查询请求的查询响应时间大于该响应时间阈值,则表示在对下一次的查询请求(即第一查询请求)的查询逻辑不进行调整,也就是说第二查询逻辑的调整满足了需要的查询性能,后续就按照该查询逻辑对查询请求进行处理。Specifically, if the query response time corresponding to the second query request is greater than the response time threshold, the second query logic is determined as the first query logic. The response time threshold is used to indicate that the second query logic is determined as the maximum value of the first query logic. If the query response time of the second query request is greater than the response time threshold, it means that the next query request (that is, the first query The query logic of the request) is not adjusted, that is to say, the adjustment of the second query logic satisfies the required query performance, and the query request is subsequently processed according to the query logic.

若第二查询请求所对应的查询响应时间小于或等于响应时间阈值,则按照缩小规则缩小第二查询逻辑所指示的N个维度的截取条件所对应的截取范围;将缩小截取范围后的第二查询逻辑确定为第一查询逻辑。其中,该截取范围用于指示截取条件所限定的范围。可以理解的是,上述N个维度的截取条件可以有对应的截取范围,N个维度中每个维度的截取条件也有对应的截取条件。该缩小规则用于指示对N个维度的截取条件所对应的截取范围进行缩小的规则。例如,截取条件A为人员数量=4,则对应的截取范围A表示人员数量=4所限定的范围;又如,截取条件B为人员数量=3,则对应的截取范围B表示人员数量=3所限定的范围;又如,截取条件C包括:人员数量=3以及时间范围=4天,则对应的截取范围C表示人员数量=3且时间范围=4天所限定的范围;显然,由于人员数量=4所限定的范围大于人员数量=3所限定的范围,则截取范围A大于截取范围B,则在查询逻辑从A变为B时,截取范围变小了,也就是缩小了截取范围;由于截取范围B中仅包括人员数量这一维度的截取条件所限定的截取范围,截取范围C包括了人员数量以及时间范围两个维度的截取条件,则截取范围B大于截取范围C,则在查询逻辑从B变为C时,截取范围变小了,也就是缩小了截取范围。可以理解的是,此步骤也就是说,在第二查询逻辑不满足需要的查询性能时,对下一次的查询请求(即第一查询请求)的查询逻辑的截取范围进行缩小,从而可以实现数据处理服务器在不断处理查询请求的过程中,对用于处理查询请求的查询逻辑不断地优化,以使得查询逻辑能够满足需要的查询性能。If the query response time corresponding to the second query request is less than or equal to the response time threshold, the interception range corresponding to the interception conditions of N dimensions indicated by the second query logic is narrowed according to the narrowing rule; The query logic is determined as the first query logic. The interception range is used to indicate the range limited by the interception condition. It can be understood that the interception conditions of the above N dimensions may have corresponding interception ranges, and the interception conditions of each of the N dimensions also have corresponding interception conditions. The narrowing rule is used to indicate a rule for narrowing the clipping range corresponding to the clipping conditions of N dimensions. For example, if the interception condition A is the number of personnel = 4, the corresponding interception range A indicates the range limited by the number of personnel = 4; for another example, if the interception condition B is the number of personnel = 3, the corresponding interception range B indicates the number of personnel = 3 For another example, the interception condition C includes: the number of persons=3 and the time range=4 days, then the corresponding interception range C represents the range limited by the number of persons=3 and the time range=4 days; The range limited by number=4 is greater than the range limited by number of personnel=3, then the interception range A is greater than the interception range B, then when the query logic changes from A to B, the interception range becomes smaller, that is, the interception range is reduced; Since the interception range B only includes the interception range defined by the interception condition of the dimension of the number of persons, and the interception range C includes the interception conditions of the two dimensions of the number of persons and the time range, then the interception range B is greater than the interception range C, then in the query When the logic changes from B to C, the interception range becomes smaller, that is, the interception range is reduced. It can be understood that this step means that when the second query logic does not meet the required query performance, the interception scope of the query logic of the next query request (ie, the first query request) is narrowed, so that the data can be realized. In the process of continuously processing the query request, the processing server continuously optimizes the query logic for processing the query request, so that the query logic can meet the required query performance.

具体的,按照缩小规则缩小第二查询逻辑所指示的N个维度的截取条件所对应的截取范围,可以包括以下方法:①按照每个维度对应的缩小间隔将第二查询逻辑所指示的N个维度的截取条件中一个或多个维度的截取条件对应的截取范围进行缩小。其中,缩小间隔用于指示在缩小对应维度的截取范围时每次缩小多大的范围,每个维度关联有对应的缩小间隔。例如,缩小间隔1对应的维度可为人员数量,缩小间隔1的大小为2个,若第二查询逻辑指示的人员数量这一维度的截取条件为人员数量=5个,则按照缩小间隔1缩小该截取条件所对应的截取范围后,该维度的截取条件变为人员数量=3个。②或者,将第二查询逻辑所指示的N个维度的截取条件增加为N+M个维度的截取条件,M为正整数。其中,N个维度的截取条件增加为N+M个维度的截取条件,也就是为第二查询逻辑增加更多维度的限定,以缩小第二查询逻辑的N个截取条件所对应的截取范围。例如,第二查询逻辑所指示的N个维度的截取条件为:人员数量=3个,在缩小截取范围时,可以增加时间范围这一个维度的截取条件(如时间范围=3天),由此可以得到2个维度(即人员数量以及时间范围)的截取条件,相当于增加了对于时间范围这一维度的限定,缩小了截取范围。Specifically, narrowing down the interception range corresponding to the interception conditions of N dimensions indicated by the second query logic according to the narrowing rule may include the following methods: ① According to the narrowing interval corresponding to each dimension, reduce the N dimensions indicated by the second query logic The interception range corresponding to the interception conditions of one or more dimensions in the interception conditions of the dimension is reduced. Wherein, the reduction interval is used to indicate how much the range is reduced each time when reducing the interception range of the corresponding dimension, and each dimension is associated with a corresponding reduction interval. For example, the dimension corresponding to the reduction interval 1 may be the number of personnel, and the size of the reduction interval 1 is 2. If the interception condition of the dimension of the number of personnel indicated by the second query logic is the number of personnel = 5, the reduction interval 1 will be reduced After the interception range corresponding to the interception condition, the interception condition of this dimension becomes the number of persons=3. ②Or, the interception conditions of N dimensions indicated by the second query logic are added to the interception conditions of N+M dimensions, where M is a positive integer. Among them, the interception conditions of N dimensions are increased to the interception conditions of N+M dimensions, that is, the restriction of more dimensions is added to the second query logic to narrow the interception range corresponding to the N interception conditions of the second query logic. For example, the interception condition of N dimensions indicated by the second query logic is: number of persons = 3. When narrowing the interception range, the interception condition of the time range dimension can be increased (for example, time range=3 days), thus The interception conditions of two dimensions (namely, the number of personnel and the time range) can be obtained, which is equivalent to increasing the limitation on the dimension of time range and narrowing the interception range.

在一种可能的实施方式中,在确定第一查询逻辑时采用何种方式对来缩小截取范围,可以根据第二查询请求的查询响应时间与响应时间阈值之间的时间差来确定。具体可以包括以下步骤:确定第二查询请求的查询响应时间与查询响应时间阈值之间的响应时间差,若响应时间差小于或等于时间差预设值,则可以按照每个维度对应的缩小间隔将第二查询逻辑所指示的N个维度的截取条件中一个或多个维度的截取条件对应的截取范围进行缩小;若响应时间差大于时间差预设值,则可以将第二查询逻辑所指示的N个维度的截取条件增加为N+M个维度的截取条件,M为正整数。其中,该响应时间差可以为第二查询请求的查询响应时间与响应时间阈值之间的时间差,例如,第二查询请求的查询响应时间为10s,时间阈值为6s,则响应时间差为10-6=4s。其中,该时间差预设值可以为预设的用于确定按照何种方式缩小截取范围的分界值。可以理解的是,可以在响应时间差小于或等于时间差预设值时,这说明第二查询逻辑已经可以基本满足查询性能,则只需要按照缩小间隔较小幅度地调整截取范围,避免过多地缩小截取范围,在后续按照查询逻辑查询数据的过程中还需要花费额外的时间对截取范围进行扩大。相反地,在响应时间差大于时间差预设值时,这说明第二查询逻辑距离满足查询性能还有较远的距离,则只需要按照通过增加维度来较大幅度地调整截取范围,以快速使得查询逻辑能够满足查询性能。In a possible implementation manner, when determining the first query logic to narrow the interception range, it may be determined according to the time difference between the query response time of the second query request and the response time threshold. Specifically, the following steps may be included: determining the response time difference between the query response time of the second query request and the query response time threshold, and if the response time difference is less than or equal to the preset time difference value, the second The interception range corresponding to the interception conditions of one or more dimensions among the interception conditions of the N dimensions indicated by the query logic is reduced; if the response time difference is greater than the preset time difference value, the N dimensions indicated by the second query logic may be used. The interception condition is increased to an interception condition of N+M dimensions, where M is a positive integer. The response time difference may be the time difference between the query response time of the second query request and the response time threshold. For example, if the query response time of the second query request is 10s and the time threshold is 6s, the response time difference is 10-6= 4s. Wherein, the preset time difference value may be a preset boundary value used for determining how to narrow the interception range. It can be understood that when the response time difference is less than or equal to the preset time difference value, it means that the second query logic can basically meet the query performance, and it is only necessary to slightly adjust the interception range according to the reduction interval to avoid excessive reduction. The interception range needs to spend extra time to expand the interception range in the subsequent process of querying data according to the query logic. Conversely, when the response time difference is greater than the preset time difference value, it means that the second query logic is still far from satisfying the query performance, and it is only necessary to adjust the interception range by increasing the dimension to quickly make the query The logic can satisfy the query performance.

可以理解的是,在实际应用场景中,在确定每个请求所对应的查询逻辑时,都可以根据查询请求前最近一次完成查询且满足目标条件的查询请求的对应的查询逻辑来确定,由此使得数据查询服务器在对各个查询请求的处理过程中,不断优化查询逻辑,从而找到满足响应时间阈值的查询逻辑便于后续的使用。在一种可能的实施方式中,从数据查询服务器对各个查询请求的持续处理过程来看,在每次通过增加维度来缩小截取范围时,可以按照一定的维度顺序来确定增加的M个维度。例如,维度顺序为维度1、维度2、维度3等等,每次增加M=1个维度,则在第一次通过增加维度来缩小截取范围时,增加维度1对应的截取条件,第二次通过增加维度来缩小截取范围时,增加维度2对应的截取条件,以此类推。It can be understood that in the actual application scenario, when determining the query logic corresponding to each request, it can be determined according to the query logic corresponding to the query request that completed the query last time before the query request and satisfies the target condition, thus This enables the data query server to continuously optimize the query logic in the process of processing each query request, so as to find the query logic that satisfies the response time threshold for subsequent use. In a possible implementation, from the perspective of the continuous processing process of each query request by the data query server, each time the interception range is narrowed by adding dimensions, the added M dimensions may be determined in a certain order of dimensions. For example, the order of dimensions is dimension 1, dimension 2, dimension 3, etc., and each time M=1 dimension is added, when the interception range is narrowed by increasing the dimension for the first time, the interception condition corresponding to dimension 1 is added, and the second time When reducing the interception range by increasing the dimension, add the interception condition corresponding to dimension 2, and so on.

S303、获取同时满足K个维度的截取条件的第一查询请求所指示查询的第一数据。S303: Acquire the first data queried by the first query request that simultaneously satisfies the interception conditions of K dimensions.

步骤S303的相关描述可以参照步骤S203,此处不做赘述。For the related description of step S303, reference may be made to step S203, which will not be repeated here.

S304、若第一数据的数据量小于目标数据量,按照扩大规则扩大K个维度的截取条件的截取范围。S304. If the data amount of the first data is less than the target data amount, expand the interception range of the interception conditions of K dimensions according to the expansion rule.

其中,该扩大规则用于指示对K个维度的截取条件所对应的截取范围进行扩大的规则。可以理解的是,若第一数据的数据量小于目标数据量,则相当于获取的数据还不足以第一客户端显示一页数据,则需要通过扩大截取范围来获取更多的数据,使得获取的数据能够多于第一客户端显示一页的数据量,以便从获取的数据中选取目标数据量的数据返回第一客户端进行显示。Wherein, the expansion rule is used to indicate a rule for expanding the interception range corresponding to the interception conditions of K dimensions. It can be understood that, if the data volume of the first data is less than the target data volume, it means that the obtained data is not enough for the first client to display one page of data, and it is necessary to obtain more data by expanding the interception range, so as to obtain more data. The data can be more than the amount of data displayed on one page by the first client, so that the data of the target data amount is selected from the acquired data and returned to the first client for display.

在一种可能的实施方式中,按照扩大规则扩大K个维度的截取条件的截取范围的方式,可以包括:①按照每个维度对应的扩大间隔将第一查询逻辑所指示的K个维度的截取条件中一个或多个维度的截取条件对应的截取范围进行扩大。其中,扩大间隔用于指示在扩大对应维度的截取范围时每次扩大多大的范围,每个维度关联有对应的扩大间隔。例如,扩大间隔1对应的维度可为人员数量,扩大间隔1的大小为2个,若第一查询逻辑指示的人员数量这一维度的截取条件为人员数量=5个,则按照扩大间隔1扩大该截取条件所对应的截取范围后,该维度的截取条件变为人员数量=7个。②或者,将第一查询逻辑所指示的K个维度的截取条件减少为K-L个维度的截取条件,L为正整数。其中,其中,K个维度的截取条件减少为K-L个维度的截取条件,也就是为第一查询逻辑减少更多维度的限定,以扩大第一查询逻辑的N个截取条件所对应的截取范围。例如,第一查询逻辑所指示的K个维度的截取条件为:人员数量=3个以及时间范围=3天,在扩大截取范围时,可以减少时间范围这一个维度的截取条件,由此可以得到1个维度(即人员数量=3)的截取条件,相当于减少了对于时间范围这一维度的限定,扩大了截取范围。In a possible implementation manner, the method of expanding the interception range of the interception conditions of K dimensions according to the expansion rule may include: (1) intercepting the K dimensions indicated by the first query logic according to the expansion interval corresponding to each dimension The interception range corresponding to the interception condition of one or more dimensions in the condition is expanded. Wherein, the expansion interval is used to indicate how much the range is expanded each time when expanding the intercepted range of the corresponding dimension, and each dimension is associated with a corresponding expansion interval. For example, the dimension corresponding to the expansion interval 1 can be the number of personnel, and the size of the expansion interval 1 is 2. If the interception condition of the dimension of the number of personnel indicated by the first query logic is the number of personnel = 5, the expansion interval 1 is expanded After the interception range corresponding to the interception condition, the interception condition of this dimension becomes the number of persons=7. ②Or, the interception conditions of K dimensions indicated by the first query logic are reduced to interception conditions of K-L dimensions, where L is a positive integer. Among them, the interception conditions of K dimensions are reduced to the interception conditions of K-L dimensions, that is, the restriction of more dimensions is reduced for the first query logic, so as to expand the interception range corresponding to the N interception conditions of the first query logic. For example, the interception conditions of the K dimensions indicated by the first query logic are: number of persons = 3 and time range = 3 days. When the interception range is expanded, the interception condition of the time range dimension can be reduced, thereby obtaining The interception condition of one dimension (that is, the number of personnel = 3) is equivalent to reducing the limitation on the dimension of time range and expanding the interception range.

S305、获取同时满足扩大截取范围后的K个维度的截取条件的第一查询请求所指示查询的第二数据。S305: Acquire the second data queried by the first query request that simultaneously satisfies the interception conditions of the K dimensions after the expanded interception range.

其中,该第二数据可以为第一查询请求所指示查询的同时满足扩大截取范围后的K个维度的截取条件的数据。可以理解的是,此处扩大截取范围后的K个维度的截取条件可以为K个或者K-L个维度的截取条件。Wherein, the second data may be data that satisfies the interception conditions of K dimensions after the expanded interception range while being queried by the first query request. It can be understood that, the interception conditions of K dimensions after expanding the interception range here may be the interception conditions of K or K-L dimensions.

步骤S305的相关描述可以参照步骤S203的相关描述,只是在获取数据时所对应的截取条件不同。For the relevant description of step S305, reference may be made to the relevant description of step S203, except that the corresponding interception conditions are different when acquiring data.

S306、若第二数据的数据量大于或等于目标数据量,从第二数据中选取目标数据量的第三目标数据,并将第三目标数据返回至第一客户端。S306. If the data volume of the second data is greater than or equal to the target data volume, select third target data of the target data volume from the second data, and return the third target data to the first client.

其中,该第三目标数据可以为第一查询请求所对应的需要返回至第一客户端中在同一页数据中进行显示的数据。步骤S306的相关描述可以参照步骤S204的相关描述,只是将从第一数据中获取第一目标数据转换为从第二数据中选取目标数据量的第三目标数据。The third target data may be data corresponding to the first query request that needs to be returned to the first client and displayed on the same page of data. The related description of step S306 may refer to the related description of step S204, except that the first target data obtained from the first data is converted into the third target data of which the target data amount is selected from the second data.

例如,例如,第一查询请求用于查询交易明细数据,K个维度的截取条件为:人员数量=2个以及时间范围=3天,则可以获取人员1与人员2在与当前时间最近的第1天、第2天和第3天的数据作为第一数据,当检测到第一数据的数据量小于目标数据量时,则可以扩大截取范围,如将截取条件变为:人员数量=2个,则可以获取到人员1和人员2在第一查询请求所指示的查询时间范围内的数据作为第二数据,进而从第二数据中选取目标数据量的第三目标数据返回至第一客户端。For example, for example, the first query request is used to query transaction detail data, and the interception conditions of the K dimensions are: number of persons = 2 and time range = 3 days, then it is possible to obtain the number of persons 1 and 2 that is the closest to the current time. The data of day 1, day 2, and day 3 are used as the first data. When it is detected that the data volume of the first data is less than the target data volume, the interception range can be expanded. For example, the interception condition can be changed to: number of personnel = 2 , the data of Person 1 and Person 2 within the query time range indicated by the first query request can be obtained as the second data, and then the third target data of the target data volume is selected from the second data and returned to the first client .

在一种可能的实施方式中,若第二数据的数据量小于目标数据量,则可以再次执行步骤S304,即按照扩大规则扩大K个维度的截取条件的截取范围,由此可以获取更多数据,直至获取到的数据的数据量大于或等于目标数据量,或者获取到了第一查询请求所指示查询的全部数据,则可以从获取到的数据中选取目标数据量的数据返回至第一客户端;或者,若获取到的第一查询请求所指示查询的全部数据,该全部数据的数据量仍小于目标数据量,则直接将该全部数据返回至第一客户端。通常来说,在不断扩大截取范围以获取对应的数据时,需要消耗一些时间,则可能反而导致查询性能的提升较少,在一些极端情况下,甚至于超过直接获取全部数据所花费的时间。但是数据处理服务器对各个查询请求的处理情况来看,上述的增加查询响应时间的情况较少,并且若扩大间隔设置得合理,这种情况可以得到缓解,在大多数情况下都能够通过上述的查询逻辑减少查询响应时间,提升查询性能。In a possible implementation manner, if the data volume of the second data is less than the target data volume, step S304 may be performed again, that is, the interception range of the interception conditions of K dimensions may be expanded according to the expansion rule, so that more data can be obtained , until the data volume of the obtained data is greater than or equal to the target data volume, or until all the data queried indicated by the first query request is obtained, the data of the target data volume can be selected from the obtained data and returned to the first client ; Or, if the data volume of the obtained data indicated by the first query request is still smaller than the target data volume, the data is directly returned to the first client. Generally speaking, it takes some time to continuously expand the interception range to obtain the corresponding data, which may lead to less improvement in query performance, and in some extreme cases, it may even exceed the time it takes to directly obtain all the data. However, in terms of the processing of each query request by the data processing server, the above-mentioned increase in query response time is rare, and if the expansion interval is set reasonably, this situation can be alleviated. Query logic reduces query response time and improves query performance.

在一种可能的实施方式中,若第一数据的数据量小于目标数据量,还可以包括以下步骤:获取同时满足K个维度的截取条件的第二查询请求所指示查询的第五数据,该第五数据为第二查询请求所指示查询的除第一数据之外的数据;若第一数据与第五数据的数据量之和大于或等于目标数据量,从第一数据与第五数据中选取目标数据量的第五目标数据,并将第五目标数据返回至第一客户端。也就是说,在第一数据的数据量不满足第一客户端一页显示的数据时,可以再次获取一轮数据(即第五数据)以满足第一客户端一页显示的数据,进而从第一数据和第五数据中获取一页数据量的数据返回至第一客户端进行显示。例如,第一查询数据用于查询交易明细数据,K个维度的截取条件为:人员数量=2个以及时间范围=3天,则可以获取人员1与人员2在与当前时间最近的第1天、第2天和第3天的数据作为第一数据,若第一数据的数据量小于目标数据量,则可以再次根据K个维度的截取条件获取数据,如获取人员3和人员4在与当前时间最近的第1天、第2天和第3天的数据作为第五数据,或者,获取人员1和人员2在与当前时间最近的第4天、第5天和第6天的数据作为第五数据,以便于在检测到第一数据与第五数据的数据量大于或等于目标数据量时,从第一数据与第五数据的选择目标数据量的数据返回至第一客户端。In a possible implementation manner, if the data volume of the first data is less than the target data volume, the following step may be further included: acquiring the fifth data queried by the second query request that satisfies the interception conditions of K dimensions at the same time, the The fifth data is the data other than the first data queried by the second query request; if the sum of the data volume of the first data and the fifth data is greater than or equal to the target data volume, from the first data and the fifth data The fifth target data of the target data volume is selected, and the fifth target data is returned to the first client. That is to say, when the data amount of the first data does not satisfy the data displayed on one page of the first client, one round of data (ie, fifth data) can be obtained again to satisfy the data displayed on one page of the first client, and then the From the first data and the fifth data, the data of the data amount of one page is returned to the first client for display. For example, the first query data is used to query transaction detail data, and the interception conditions of K dimensions are: number of persons = 2 and time range = 3 days, then the first day closest to the current time for Person 1 and Person 2 can be obtained , The data of the 2nd and 3rd days are used as the first data. If the data volume of the first data is less than the target data volume, the data can be obtained again according to the interception conditions of K dimensions, such as obtaining personnel 3 and personnel 4. The data of the 1st, 2nd, and 3rd days closest to the time is used as the fifth data, or, the data of the 4th, 5th, and 6th days closest to the current time of Person 1 and Person 2 are obtained as the 5th data. Five data, so that when it is detected that the data volume of the first data and the fifth data is greater than or equal to the target data volume, the data of the selected target data volume of the first data and the fifth data is returned to the first client.

本申请实施例能够在检测到查询请求中的查询范围信息满足目标条件时,确定对应的查询逻辑以截取同时满足所述K个维度的截取条件的第一数据,由此可以仅获取查询请求所指示查询的数据中的部分数据,进而从第一数据中确定出目标数据量的数据返回至对应的客户端。由于获取部分数据所需花费的时间相较于获取查询请求所指示查询的全部数据来说,所需花费的时间更少,由此有助于减少数据查询的响应时间。In the embodiment of the present application, when it is detected that the query range information in the query request satisfies the target condition, the corresponding query logic is determined to intercept the first data that simultaneously satisfies the interception conditions of the K dimensions, so that only the information in the query request can be obtained. Indicate part of the data in the queried data, and then return the data of the target data amount from the first data to the corresponding client. Since the time required to acquire part of the data is less than the time required to acquire all the data queried indicated by the query request, the response time of the data query can be reduced.

请参见图4,图4是本申请实施例提供的一种数据查询方法的流程示意图,该方法可以由上述所提及的电子设备执行。该数据查询方法可以包括以下步骤。Referring to FIG. 4 , FIG. 4 is a schematic flowchart of a data query method provided by an embodiment of the present application, and the method may be executed by the above-mentioned electronic device. The data query method may include the following steps.

S401、接收第一客户端发送的第一查询请求。S401. Receive a first query request sent by a first client.

S402、若查询范围信息满足目标条件,确定第一查询逻辑。S402. If the query range information satisfies the target condition, determine the first query logic.

S403、获取同时满足K个维度的截取条件的第一查询请求所指示查询的第一数据。S403: Obtain the first data queried by the first query request that simultaneously satisfies the interception conditions of K dimensions.

S404、若第一数据的数据量大于或等于目标数据量,从第一数据中选取目标数据量的第一目标数据,并将第一目标数据返回至第一客户端。S404. If the data volume of the first data is greater than or equal to the target data volume, select first target data of the target data volume from the first data, and return the first target data to the first client.

其中,步骤S401-S404可以参照步骤S201-S204的相关描述,此处不做赘述。Wherein, for steps S401-S404, reference may be made to the relevant descriptions of steps S201-S204, which will not be repeated here.

S405、当接收到针对第一查询请求的剩余数据查询指令时,确定第一数据中除去目标数据量的数据后的剩余数据的数据量。S405. When receiving the remaining data query instruction for the first query request, determine the data volume of the remaining data after removing the target data volume from the first data.

其中,该剩余数据查询指令用于指示查询第一查询请求所指示查询的数据中剩余的数据,该剩余数据也就是在除去返回至第一客户端的第一目标数据外的数据。在一种可能的实施方式中,第一客户端在检测到用户点击用于指示查询剩余数据的控件时,第一客户端可以向数据查询服务器发送针对第一查询请求的剩余数据查询指令。例如,用户在第一客户端中点击“下一页”的控件,则触发第一客户端向数据查询服务器发送剩余数据查询指令。The remaining data query instruction is used to instruct to query the remaining data in the data queried by the first query request, and the remaining data is the data excluding the first target data returned to the first client. In a possible implementation manner, when the first client detects that the user clicks on the control for instructing to query the remaining data, the first client may send a remaining data query instruction for the first query request to the data query server. For example, when the user clicks on the "next page" control in the first client terminal, the first client terminal is triggered to send the remaining data query instruction to the data query server.

例如,第一数据为人员1与人员2在与当前时间最近的第1天、第2天和第3天的数据,第一数据的数据量为25条,目标数据量为20条,则第一数据中除去目标数据量的数据后的剩余数据的数据量为25-20=5条。For example, the first data is the data of Person 1 and Person 2 on the 1st, 2nd, and 3rd days closest to the current time, the data volume of the first data is 25, and the target data volume is 20, then The data volume of the remaining data after excluding the data of the target data volume in one piece of data is 25-20=5 pieces.

可以理解的是,S406与S407不具有步骤的先后顺序,可以根据剩余数据的数据量选择执行S406或者S407。It can be understood that S406 and S407 do not have a sequence of steps, and S406 or S407 can be selected to be executed according to the data amount of the remaining data.

S406、若剩余数据的数据量大于或等于目标数据量,从剩余数据中确定出目标数据量的数据发送至第一客户端。S406. If the data volume of the remaining data is greater than or equal to the target data volume, determine the target data volume from the remaining data and send the data to the first client.

其中,从剩余数据中确定出目标数据量的数据的方法,可以参照步骤S204中从第一数据中选取目标数据量的第一目标数据的方法,即可以从剩余数据中随机选择,也可以按照一定顺序从剩余数据中选择,此处不做赘述。由此可以在剩余数据中快去确定出目标数据量的数据,不需要再次获取数据,提升数据查询的效率。Wherein, the method of determining the data of the target data volume from the remaining data can refer to the method of selecting the first target data of the target data volume from the first data in step S204, that is, it can be randomly selected from the remaining data, or can be selected according to Select from the remaining data in a certain order, which will not be repeated here. In this way, the data of the target data volume can be quickly determined from the remaining data, and there is no need to obtain the data again, which improves the efficiency of data query.

S407、若剩余数据的数据量小于目标数据量,则根据第一查询逻辑获取除第一数据外的同时满足K个维度的截取条件的第三数据,并根据剩余数据与第三数据确定出目标数据量的数据发送至第一客户端。S407. If the data volume of the remaining data is less than the target data volume, obtain third data other than the first data and satisfy the interception conditions of K dimensions according to the first query logic, and determine the target according to the remaining data and the third data The amount of data is sent to the first client.

其中,根据第一查询逻辑获取除第一数据外的同时满足K个维度的截取条件的第三数据的方法,可以参照步骤S203的相关描述,此处不做赘述。根据剩余数据与第三数据确定出目标数据量的数据,可以参照步骤S204中从第一数据中选取目标数据量的第一目标数据的方法,即可以从剩余数据与第三数据中随机选择,也可以按照一定顺序从剩余数据与第三数据中选择,此处不做赘述。在一种可能的实施方式中,还可以从第三数据中选择目标数据量与剩余数据的数据量之间的差值的数据量的数据,并将从第三数据中选择的数据与剩余数据返回至第一客户端,由此可以先将剩余数据返回至客户端,避免与第一数据关联性更强的剩余数据不能及时返回至第一客户端。Wherein, for the method for obtaining third data other than the first data and satisfying the interception conditions of K dimensions according to the first query logic, reference may be made to the relevant description of step S203, which will not be repeated here. The data of the target data volume is determined according to the remaining data and the third data, and the method for selecting the first target data of the target data volume from the first data in step S204 can be referred to, that is, it can be randomly selected from the remaining data and the third data, It can also be selected from the remaining data and the third data in a certain order, which will not be repeated here. In a possible implementation manner, the data of the data amount of the difference between the target data amount and the data amount of the remaining data can also be selected from the third data, and the data selected from the third data can be compared with the remaining data By returning to the first client, the remaining data can be returned to the client first, so as to avoid that the remaining data with stronger correlation with the first data cannot be returned to the first client in time.

本申请实施例能够在检测到查询请求中的查询范围信息满足目标条件时,确定对应的查询逻辑以截取同时满足所述K个维度的截取条件的第一数据,由此可以仅获取查询请求所指示查询的数据中的部分数据,进而从第一数据中确定出目标数据量的数据返回至对应的客户端。由于获取部分数据所需花费的时间相较于获取查询请求所指示查询的全部数据来说,所需花费的时间更少,由此有助于减少数据查询的响应时间。In the embodiment of the present application, when it is detected that the query range information in the query request satisfies the target condition, the corresponding query logic is determined to intercept the first data that simultaneously satisfies the interception conditions of the K dimensions, so that only the information in the query request can be obtained. Indicate part of the data in the queried data, and then return the data of the target data amount from the first data to the corresponding client. Since the time required to acquire part of the data is less than the time required to acquire all the data queried indicated by the query request, the response time of the data query can be reduced.

请参见图5,图5是本申请实施例提供的一种数据查询装置的结构示意图。可选的,该数据查询装置可以设置于上述电子设备中。如图5所示,本实施例中所描述的数据查询装置可以包括:Please refer to FIG. 5 , which is a schematic structural diagram of a data query apparatus provided by an embodiment of the present application. Optionally, the data query device may be set in the above electronic device. As shown in FIG. 5 , the data query apparatus described in this embodiment may include:

接收单元501,用于接收第一客户端发送的第一查询请求,所述第一查询请求携带请求查询的查询范围信息;A receiving unit 501, configured to receive a first query request sent by a first client, where the first query request carries query range information requested to be queried;

处理单元502,用于若所述查询范围信息满足目标条件,确定第一查询逻辑,所述第一查询逻辑用于指示K个维度的截取条件的信息,K为正整数;A processing unit 502, configured to determine a first query logic if the query range information satisfies the target condition, where the first query logic is used to indicate the information of the interception conditions of K dimensions, where K is a positive integer;

获取单元503,用于获取同时满足所述K个维度的截取条件的所述第一查询请求所指示查询的第一数据;an obtaining unit 503, configured to obtain the first data queried by the first query request that simultaneously satisfies the interception conditions of the K dimensions;

所述处理单元502,还用于若所述第一数据的数据量大于或等于目标数据量,从所述第一数据中选取所述目标数据量的第一目标数据,并将所述第一目标数据返回至所述第一客户端。The processing unit 502 is further configured to select the first target data of the target data volume from the first data if the data volume of the first data is greater than or equal to the target data volume, and convert the first data volume to the target data volume. Target data is returned to the first client.

在一种实现方式中,所述处理单元502,还用于:In an implementation manner, the processing unit 502 is further configured to:

接收第二客户端发送的第二查询请求,确定第二查询逻辑;所述第二查询请求为所述第一查询请求前最近一次完成查询且满足所述目标条件的查询请求,所述第二查询逻辑用于指示N个维度的截取条件的信息,N为正整数;Receive the second query request sent by the second client, and determine the second query logic; the second query request is the query request that completed the last query before the first query request and satisfies the target condition, and the second query request The query logic is used to indicate the information of the interception conditions of N dimensions, where N is a positive integer;

根据所述第二查询逻辑确定出对应的第二目标数据,并将所述第二目标数据返回至所述第二客户端;Determine the corresponding second target data according to the second query logic, and return the second target data to the second client;

记录所述第二查询请求所对应的查询响应时间,所述查询响应时间用于指示接收到所述第二查询请求的时间与向所述第二客户端返回所述第二目标数据的时间之间的时间差;Record the query response time corresponding to the second query request, where the query response time is used to indicate the difference between the time when the second query request is received and the time when the second target data is returned to the second client. time difference between

所述确定第一查询逻辑,包括:The determining the first query logic includes:

根据所述第二查询请求所对应的查询响应时间以及所述第二查询逻辑确定第一查询逻辑。The first query logic is determined according to the query response time corresponding to the second query request and the second query logic.

在一种实现方式中,所述处理单元502,具体用于:In an implementation manner, the processing unit 502 is specifically configured to:

若所述第二查询请求所对应的查询响应时间大于响应时间阈值,则将所述第二查询逻辑确定为第一查询逻辑。If the query response time corresponding to the second query request is greater than the response time threshold, the second query logic is determined as the first query logic.

在一种实现方式中,所述处理单元502,具体用于:In an implementation manner, the processing unit 502 is specifically configured to:

若所述第二查询请求所对应的查询响应时间小于或等于响应时间阈值,则按照缩小规则缩小所述第二查询逻辑所指示的N个维度的截取条件所对应的截取范围;If the query response time corresponding to the second query request is less than or equal to the response time threshold, reducing the interception range corresponding to the interception conditions of the N dimensions indicated by the second query logic according to the narrowing rule;

将缩小截取范围后的第二查询逻辑确定为第一查询逻辑。The second query logic after narrowing the interception range is determined as the first query logic.

在一种实现方式中,所述处理单元502,具体用于:In an implementation manner, the processing unit 502 is specifically configured to:

按照每个维度对应的缩小间隔将所述第二查询逻辑所指示的所述N个维度的截取条件中一个或多个维度的截取条件对应的截取范围进行缩小;reducing the interception range corresponding to the interception conditions of one or more dimensions among the interception conditions of the N dimensions indicated by the second query logic according to the reduction interval corresponding to each dimension;

或者,将所述第二查询逻辑所指示的所述N个维度的截取条件增加为N+M个维度的截取条件,M为正整数。Alternatively, the interception conditions of the N dimensions indicated by the second query logic are added to the interception conditions of N+M dimensions, where M is a positive integer.

在一种实现方式中,所述处理单元502,还用于:In an implementation manner, the processing unit 502 is further configured to:

若所述第一数据的数据量小于目标数据量,按照扩大规则扩大所述K个维度的截取条件的截取范围;If the data volume of the first data is less than the target data volume, expand the interception range of the interception conditions of the K dimensions according to the expansion rule;

获取同时满足扩大截取范围后的K个维度的截取条件的所述第一查询请求所指示查询的第二数据;acquiring the second data queried by the first query request that simultaneously satisfies the interception conditions of the K dimensions after the expanded interception range;

若所述第二数据的数据量大于或等于目标数据量,从所述第二数据中选取所述目标数据量的第三目标数据,并将所述第三目标数据返回至所述第一客户端。If the data volume of the second data is greater than or equal to the target data volume, select third target data of the target data volume from the second data, and return the third target data to the first client end.

在一种实现方式中,所述处理单元502,还用于:In an implementation manner, the processing unit 502 is further configured to:

当接收到针对所述第一查询请求的剩余数据查询指令时,确定所述第一数据中除去所述目标数据量的数据后的剩余数据的数据量;When receiving the remaining data query instruction for the first query request, determine the data volume of the remaining data after removing the data of the target data volume from the first data;

若所述剩余数据的数据量大于或等于所述目标数据量,从所述剩余数据中确定出目标数据量的数据发送至所述第一客户端;If the data volume of the remaining data is greater than or equal to the target data volume, the data of the target data volume determined from the remaining data is sent to the first client;

若所述剩余数据的数据量小于所述目标数据量,则根据所述第一查询逻辑获取除所述第一数据外的同时满足所述K个维度的截取条件的第三数据,并根据所述剩余数据与所述第三数据确定出目标数据量的数据发送至所述第一客户端。If the data volume of the remaining data is less than the target data volume, obtain third data other than the first data and satisfy the interception conditions of the K dimensions according to the first query logic, and obtain the third data according to the first query logic. The target data amount determined by the remaining data and the third data is sent to the first client.

请参见图6,图6是本申请实施例提供的一种电子设备的结构示意图。本实施例中所描述的电子设备,包括:处理器601、存储器602。可选的,该电子设备还可包括网络接口或供电模块等结构。上述处理器601、存储器602之间可以交互数据。Please refer to FIG. 6 , which is a schematic structural diagram of an electronic device provided by an embodiment of the present application. The electronic device described in this embodiment includes: a processor 601 and a memory 602 . Optionally, the electronic device may further include structures such as a network interface or a power supply module. Data can be exchanged between the above-mentioned processor 601 and memory 602 .

上述处理器601可以是中央处理单元(Central Processing Unit,CPU),该处理器还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。The aforementioned processor 601 may be a central processing unit (Central Processing Unit, CPU), and the processor may also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC) ), off-the-shelf programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.

上述网络接口可以包括输入设备和/或输出设备,例如该输入设备是可以是控制面板、麦克风、接收器等,输出设备可以是显示屏、发送器等,此处不一一列举。例如,在申请实施例中,该网络接口可包括接收器和发送器。The above-mentioned network interface may include an input device and/or an output device, for example, the input device may be a control panel, a microphone, a receiver, etc., and the output device may be a display screen, a transmitter, etc., which are not listed here one by one. For example, in application embodiments, the network interface may include a receiver and a transmitter.

上述存储器602可以包括只读存储器和随机存取存储器,并向处理器601提供程序指令和数据。存储器602的一部分还可以包括非易失性随机存取存储器。其中,所述处理器601调用所述程序指令时用于执行:The above-mentioned memory 602 may include read-only memory and random access memory, and provides program instructions and data to the processor 601 . A portion of memory 602 may also include non-volatile random access memory. Wherein, when the processor 601 calls the program instructions, it is used to execute:

接收第一客户端发送的第一查询请求,所述第一查询请求携带请求查询的查询范围信息;receiving a first query request sent by a first client, where the first query request carries the query scope information of the requested query;

若所述查询范围信息满足目标条件,确定第一查询逻辑,所述第一查询逻辑用于指示K个维度的截取条件的信息,K为正整数;If the query range information satisfies the target condition, determine the first query logic, where the first query logic is used to indicate the information of the interception conditions of K dimensions, where K is a positive integer;

获取同时满足所述K个维度的截取条件的所述第一查询请求所指示查询的第一数据;obtaining the first data queried by the first query request that simultaneously satisfies the interception conditions of the K dimensions;

若所述第一数据的数据量大于或等于目标数据量,从所述第一数据中选取所述目标数据量的第一目标数据,并将所述第一目标数据返回至所述第一客户端。If the data volume of the first data is greater than or equal to the target data volume, select the first target data of the target data volume from the first data, and return the first target data to the first client end.

在一种实现方式中,所述处理器601,还用于:In an implementation manner, the processor 601 is further configured to:

接收第二客户端发送的第二查询请求,确定第二查询逻辑;所述第二查询请求为所述第一查询请求前最近一次完成查询且满足所述目标条件的查询请求,所述第二查询逻辑用于指示N个维度的截取条件的信息,N为正整数;Receive the second query request sent by the second client, and determine the second query logic; the second query request is the query request that completed the last query before the first query request and satisfies the target condition, and the second query request The query logic is used to indicate the information of the interception conditions of N dimensions, where N is a positive integer;

根据所述第二查询逻辑确定出对应的第二目标数据,并将所述第二目标数据返回至所述第二客户端;Determine the corresponding second target data according to the second query logic, and return the second target data to the second client;

记录所述第二查询请求所对应的查询响应时间,所述查询响应时间用于指示接收到所述第二查询请求的时间与向所述第二客户端返回所述第二目标数据的时间之间的时间差;Record the query response time corresponding to the second query request, where the query response time is used to indicate the difference between the time when the second query request is received and the time when the second target data is returned to the second client. time difference between

所述确定第一查询逻辑,包括:The determining the first query logic includes:

根据所述第二查询请求所对应的查询响应时间以及所述第二查询逻辑确定第一查询逻辑。The first query logic is determined according to the query response time corresponding to the second query request and the second query logic.

在一种实现方式中,所述处理器601,具体用于:In an implementation manner, the processor 601 is specifically configured to:

若所述第二查询请求所对应的查询响应时间大于响应时间阈值,则将所述第二查询逻辑确定为第一查询逻辑。If the query response time corresponding to the second query request is greater than the response time threshold, the second query logic is determined as the first query logic.

在一种实现方式中,所述处理器601,具体用于:In an implementation manner, the processor 601 is specifically configured to:

若所述第二查询请求所对应的查询响应时间小于或等于响应时间阈值,则按照缩小规则缩小所述第二查询逻辑所指示的N个维度的截取条件所对应的截取范围;If the query response time corresponding to the second query request is less than or equal to the response time threshold, reducing the interception range corresponding to the interception conditions of the N dimensions indicated by the second query logic according to the narrowing rule;

将缩小截取范围后的第二查询逻辑确定为第一查询逻辑。The second query logic after narrowing the interception range is determined as the first query logic.

在一种实现方式中,所述处理器601,具体用于:In an implementation manner, the processor 601 is specifically configured to:

按照每个维度对应的缩小间隔将所述第二查询逻辑所指示的所述N个维度的截取条件中一个或多个维度的截取条件对应的截取范围进行缩小;reducing the interception range corresponding to the interception conditions of one or more dimensions among the interception conditions of the N dimensions indicated by the second query logic according to the reduction interval corresponding to each dimension;

或者,将所述第二查询逻辑所指示的所述N个维度的截取条件增加为N+M个维度的截取条件,M为正整数。Alternatively, the interception conditions of the N dimensions indicated by the second query logic are added to the interception conditions of N+M dimensions, where M is a positive integer.

在一种实现方式中,所述处理器601,还用于:In an implementation manner, the processor 601 is further configured to:

若所述第一数据的数据量小于目标数据量,按照扩大规则扩大所述K个维度的截取条件的截取范围;If the data volume of the first data is less than the target data volume, expand the interception range of the interception conditions of the K dimensions according to the expansion rule;

获取同时满足扩大截取范围后的K个维度的截取条件的所述第一查询请求所指示查询的第二数据;acquiring the second data queried by the first query request that simultaneously satisfies the interception conditions of the K dimensions after the expanded interception range;

若所述第二数据的数据量大于或等于目标数据量,从所述第二数据中选取所述目标数据量的第三目标数据,并将所述第三目标数据返回至所述第一客户端。If the data volume of the second data is greater than or equal to the target data volume, select third target data of the target data volume from the second data, and return the third target data to the first client end.

在一种实现方式中,所述处理器601,还用于:In an implementation manner, the processor 601 is further configured to:

当接收到针对所述第一查询请求的剩余数据查询指令时,确定所述第一数据中除去所述目标数据量的数据后的剩余数据的数据量;When receiving the remaining data query instruction for the first query request, determine the data volume of the remaining data after removing the data of the target data volume from the first data;

若所述剩余数据的数据量大于或等于所述目标数据量,从所述剩余数据中确定出目标数据量的数据发送至所述第一客户端;If the data volume of the remaining data is greater than or equal to the target data volume, the data of the target data volume determined from the remaining data is sent to the first client;

若所述剩余数据的数据量小于所述目标数据量,则根据所述第一查询逻辑获取除所述第一数据外的同时满足所述K个维度的截取条件的第三数据,并根据所述剩余数据与所述第三数据确定出目标数据量的数据发送至所述第一客户端。If the data volume of the remaining data is less than the target data volume, obtain third data other than the first data and satisfy the interception conditions of the K dimensions according to the first query logic, and obtain the third data according to the first query logic. The target data amount determined by the remaining data and the third data is sent to the first client.

可选的,该程序指令被处理器执行时还可实现上述实施例中方法的其他步骤,这里不再赘述。Optionally, when the program instructions are executed by the processor, other steps of the methods in the foregoing embodiments may also be implemented, which will not be repeated here.

本申请还提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序包括程序指令,所述程序指令当被处理器执行时使所述处理器执行上述方法,比如执行上述电子设备执行的方法,此处不赘述。The present application also provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and the computer program includes program instructions, the program instructions, when executed by a processor, cause the processor to execute the above-mentioned The method, such as executing the method executed by the above-mentioned electronic device, will not be described in detail here.

可选的,本申请涉及的存储介质如计算机可读存储介质可以是非易失性的,也可以是易失性的。Optionally, the storage medium involved in this application, such as a computer-readable storage medium, may be non-volatile or volatile.

可选的,该计算机可读存储介质可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序等;存储数据区可存储根据区块链节点的使用所创建的数据等。其中,本申请所指区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链(Blockchain),本质上是一个去中心化的数据库,是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一批次网络交易的信息,用于验证其信息的有效性(防伪)和生成下一个区块。区块链可以包括区块链底层平台、平台产品服务层以及应用服务层等。Optionally, the computer-readable storage medium may mainly include a stored program area and a stored data area, wherein the stored program area may store an operating system, an application program required by at least one function, and the like; The data created by the use of the node, etc. Among them, the blockchain referred to in this application is a new application mode of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. Blockchain, essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information to verify its Validity of information (anti-counterfeiting) and generation of the next block. The blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.

需要说明的是,对于前述的各个方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某一些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本申请所必须的。It should be noted that, for the sake of simple description, the foregoing method embodiments are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited by the described action sequence. Because in accordance with the present application, certain steps may be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读存储介质中,存储介质可以包括:闪存盘、只读存储器(Read-Only Memory,ROM)、随机存取器(Random AccessMemory,RAM)、磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing relevant hardware through a program, and the program can be stored in a computer-readable storage medium, and the storage medium can include: Flash disk, read-only memory (Read-Only Memory, ROM), random access device (Random Access Memory, RAM), magnetic disk or optical disk, etc.

本申请实施例还提供了一种计算机程序产品或计算机程序,该计算机程序产品或计算机程序包括计算机指令,该计算机指令存储在计算机可读存储介质中。计算机设备的处理器从计算机可读存储介质读取该计算机指令,处理器执行该计算机指令,使得该计算机设备执行上述各方法的实施例中所执行的步骤。例如,该计算机设备可以为终端,或者可以为服务器。Embodiments of the present application also provide a computer program product or computer program, where the computer program product or computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps performed in the embodiments of the above methods. For example, the computer device may be a terminal, or it may be a server.

以上对本申请实施例所提供的一种数据查询方法、装置、电子设备及存储介质进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。A data query method, device, electronic device, and storage medium provided by the embodiments of the present application have been described in detail above. The principles and implementations of the present application are described with specific examples. The descriptions of the above embodiments are only It is used to help understand the method and the core idea of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, there will be changes in the specific embodiments and application scope. The contents of the description should not be construed as limiting the application.

Claims (10)

1. A method for data query, the method comprising:
receiving a first query request sent by a first client, wherein the first query request carries query range information requested to be queried;
if the query range information meets the target condition, determining a first query logic, wherein the first query logic is used for indicating the information of the interception conditions of K dimensions, and K is a positive integer;
acquiring first data which meets the interception conditions of the K dimensions and is inquired by the first inquiry request;
and if the data volume of the first data is larger than or equal to the target data volume, selecting the first target data of the target data volume from the first data, and returning the first target data to the first client.
2. The method of claim 1, wherein before receiving the first query request sent by the first client, the method further comprises:
receiving a second query request sent by a second client, and determining a second query logic; the second query request is a query request which completes the query last time before the first query request and meets the target condition, the second query logic is used for indicating the information of the interception conditions of N dimensions, and N is a positive integer;
determining corresponding second target data according to the second query logic, and returning the second target data to the second client;
recording query response time corresponding to the second query request, wherein the query response time is used for indicating a time difference between the time of receiving the second query request and the time of returning the second target data to the second client;
the determining a first query logic, comprising:
and determining the first query logic according to the query response time corresponding to the second query request and the second query logic.
3. The method of claim 2, wherein determining the first query logic according to the query response time corresponding to the second query request and the second query logic comprises:
and if the query response time corresponding to the second query request is greater than a response time threshold, determining the second query logic as the first query logic.
4. The method of claim 2, wherein determining the first query logic according to the query response time corresponding to the second query request and the second query logic comprises:
if the query response time corresponding to the second query request is smaller than or equal to a response time threshold, narrowing down interception ranges corresponding to the interception conditions of the N dimensions indicated by the second query logic according to a narrowing-down rule;
and determining the second query logic with the reduced interception range as the first query logic.
5. The method according to claim 4, wherein the narrowing down the truncation range corresponding to the truncation conditions of the N dimensions indicated by the second query logic according to the narrowing-down rule includes:
narrowing down the interception range corresponding to one or more dimensionalities of the interception conditions of the N dimensionalities indicated by the second inquiry logic according to the narrowing-down interval corresponding to each dimensionality;
or, the N-dimensional truncation conditions indicated by the second query logic are increased to N + M-dimensional truncation conditions, where M is a positive integer.
6. The method of claim 1, further comprising:
if the data volume of the first data is smaller than the target data volume, enlarging the interception range of the interception conditions of the K dimensions according to an enlargement rule;
acquiring second data which meets the interception conditions of K dimensions after the interception range is expanded and is inquired by the first inquiry request;
and if the data volume of the second data is larger than or equal to the target data volume, selecting third target data of the target data volume from the second data, and returning the third target data to the first client.
7. The method of claim 1, wherein after returning the first target data to the first client, further comprising:
when a residual data query instruction aiming at the first query request is received, determining the data volume of the residual data after the data with the target data volume is removed from the first data;
if the data volume of the residual data is larger than or equal to the target data volume, determining data of the target data volume from the residual data and sending the data of the target data volume to the first client;
and if the data volume of the residual data is smaller than the target data volume, acquiring third data which meets the interception conditions of the K dimensions except the first data according to the first query logic, and determining data of the target data volume according to the residual data and the third data and sending the data to the first client.
8. A data query apparatus, comprising:
the device comprises a receiving unit, a query processing unit and a query processing unit, wherein the receiving unit is used for receiving a first query request sent by a first client, and the first query request carries query range information requested to be queried;
the processing unit is used for determining a first query logic if the query range information meets a target condition, wherein the first query logic is used for indicating information of interception conditions of K dimensions, and K is a positive integer;
an obtaining unit, configured to obtain first data of a query indicated by the first query request that simultaneously satisfies the interception conditions of the K dimensions;
the processing unit is further configured to select first target data of the target data size from the first data and return the first target data to the first client if the data size of the first data is greater than or equal to the target data size.
9. An electronic device comprising a processor, a memory, wherein the memory is configured to store a computer program comprising program instructions, and wherein the processor is configured to invoke the program instructions to perform the method of any of claims 1-7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program comprising program instructions that, when executed by a processor, cause the processor to carry out the method according to any one of claims 1-7.
CN202210143806.0A 2022-02-16 2022-02-16 Data query method and device, electronic equipment and storage medium Pending CN114490719A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210143806.0A CN114490719A (en) 2022-02-16 2022-02-16 Data query method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210143806.0A CN114490719A (en) 2022-02-16 2022-02-16 Data query method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114490719A true CN114490719A (en) 2022-05-13

Family

ID=81482780

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210143806.0A Pending CN114490719A (en) 2022-02-16 2022-02-16 Data query method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114490719A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024022119A1 (en) * 2022-07-26 2024-02-01 华为技术有限公司 Data synchronization method, electronic device and system

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110096489A (en) * 2019-04-30 2019-08-06 阿里巴巴集团控股有限公司 A kind of data query method, system, device and electronic equipment
CN110334118A (en) * 2019-05-31 2019-10-15 口碑(上海)信息技术有限公司 Data query method and device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110096489A (en) * 2019-04-30 2019-08-06 阿里巴巴集团控股有限公司 A kind of data query method, system, device and electronic equipment
CN110334118A (en) * 2019-05-31 2019-10-15 口碑(上海)信息技术有限公司 Data query method and device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024022119A1 (en) * 2022-07-26 2024-02-01 华为技术有限公司 Data synchronization method, electronic device and system

Similar Documents

Publication Publication Date Title
CN111344706B (en) Method and system for managing transactions on blockchain
US9721015B2 (en) Providing a query results page
CN113364853B (en) Business service system, business request method and gateway equipment
US20150058308A1 (en) Generating cache query requests
US11403346B2 (en) Method and device for searching for information in applications
WO2018064242A1 (en) Query-time analytics on graph queries spanning subgraphs
CN106658096A (en) Method and device for pushing live program
JP2012526320A (en) Method and system for search using search engine indexing and index
CN110134707A (en) A data query method, device, electronic equipment and storage medium
CN107798135B (en) Paging query method and device and electronic equipment
JP2022106948A (en) Information display method, device, electronic apparatus, storage media, and computer program
TW202027003A (en) Method and system for accepting blockchain evidence storage transaction
CN112182107B (en) List data acquisition method, device, computer equipment and storage medium
CN110929131A (en) Data export method, device, equipment and storage medium
CN113761565B (en) Data desensitization method and device
CN116611411A (en) Business system report generation method, device, equipment and storage medium
CN114490719A (en) Data query method and device, electronic equipment and storage medium
CN109086414B (en) Method, apparatus and storage medium for searching blockchain data
US11354492B2 (en) EDOC utility using non-structured-query-language databases
CN107977381B (en) Data configuration method, index management method, related device and computing equipment
CN111459981B (en) Query task processing method, device, server and system
CN113760178A (en) Cache data processing method and device, electronic equipment and computer readable medium
CN108256989B (en) Data display method and system of fund preparation system
CN116308778A (en) Stock information generation method, device, electronic equipment and storage medium
CN119960894A (en) Information processing method, device, electronic device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination