Data paging query method and device, medium and computer program

By storing the pre-read data of deep paging queries in a temporary table in the database management system, the problem of inefficient deep paging queries is solved, efficient processing of large data volume scenarios is achieved, and query speed is significantly improved.

CN119759955AInactive Publication Date: 2025-04-04BEIJING PACTERA JINXIN TECH LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411930604.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-25
Publication Date
2025-04-04
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The prior art is inefficient in handling deep paging queries, especially in the case of large offsets, which may result in processing timeouts and application exceptions.

Method used

When the request is first paged and query, a certain amount of data in the filtering result set is placed after the data on this page as pre-read data and stored in a temporary table. During subsequent paged query requests, data is obtained from the temporary table to avoid scanning of a large amount of unnecessary data.

Benefits of technology

It effectively solves the problem of slow in-depth paging query in large data scenarios, improves the processing efficiency of the database management system, reduces the scanning of a large amount of useless data, and significantly improves the query speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119759955A_ABST
    Figure CN119759955A_ABST
Patent Text Reader

Abstract

The invention provides a data paging query method and device, a medium and a computer program, and relates to the technical field of data processing. The method comprises the following steps: in response to a previous paging query request, returning data between a first specified starting position and a first specified ending position in a screening result set as a query result, reading data between the first specified ending position and a pre-reading ending position, and storing the data in a temporary table; the first specified starting position and the first specified ending position are determined by the previous paging query request; in response to a post-paging query request, returning data between a second specified starting position and a second specified ending position in the temporary table as a query result; the second designated start position and the second designated end position are determined by the last paging query request. According to the method, scanning of a large amount of unnecessary data is avoided, the problem that deep paging query is slow in a large-data-volume scene is effectively solved, and the processing efficiency of a database management system is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a data paging query method, device, medium and computer program. Background Art

[0002] Data paging is a key operation in database management, especially when dealing with large-scale data sets. When a database loads a large amount of data at one time, it consumes a lot of system resources and time. Page queries can process data in segments, and only a small part of the data needs to be queried each time, thereby greatly improving query efficiency. Offset-based paging technology is a traditional method of data paging and is widely used in various business scenarios. It accesses data by skipping a specified number of records before retrieving and returning a certain number of records. This technology is often used in Web and database applications to navigate directly to a specific page using a simple numeric offset.

[0003] When paging query results based on offset, it is generally necessary to find the specified offset position from the filtered result set, that is, skip the specified number of records. For example, to obtain the 10001st to 10010th records in the result set, the database management system needs to scan and skip the first 10000 records during execution, and then return the next 10 records. As you can imagine, the larger the offset n, the lower the execution efficiency. When the offset value is large (generally called deep paging), for example, more than one million, it may cause processing timeouts and application exceptions. Summary of the invention

[0004] The present invention provides a data paging query method, device, medium and computer program, which are used to solve the defect of slow deep paging query in the prior art and improve the speed of deep paging query.

[0005] The present invention provides a data paging query method, comprising the following steps.

[0006] In response to a previous paging query request, data between a first specified starting position and a first specified ending position in a screening result set are returned as query results, and data between the first specified ending position and a pre-reading ending position are read and stored in a temporary table; the previous paging query request includes the first offset and the first page capacity, the first specified starting position is determined by the first offset, and the first specified ending position is determined by the first offset and the first page capacity; In response to a post-paging query request, the data between the second specified starting position and the second specified ending position in the temporary table is returned as a query result; the post-paging query request includes the second offset and the second page capacity, the second specified starting position is determined by the second offset, and the second specified ending position is determined by the second offset and the second page capacity.

[0007] According to the data paging query method provided by the present invention, before returning the data between the first specified starting position and the first specified ending position in the screening result set as the query result and reading the data between the first specified ending position and the pre-reading ending position and storing them in the temporary table, it also includes: Determine whether the first offset is greater than a set threshold. If the first offset is greater than the set threshold, return the data between the first specified starting position and the first specified ending position in the filter result set as the query result, and read the data between the first specified ending position and the pre-read ending position and store them in a temporary table.

[0008] The data paging query method provided by the present invention also includes: If the first offset is less than or equal to the set threshold, the data between the first specified starting position and the first specified ending position in the screening result set is returned as the query result.

[0009] According to the data paging query method provided by the present invention, before returning the data between the second specified starting position and the second specified ending position in the temporary table as the query result, it also includes: Determining whether the second designated starting position and the second designated ending position are both located between the first designated ending position and the pre-reading ending position; If the second specified starting position and the second specified ending position are both located between the first specified ending position and the pre-read ending position, the data between the second specified starting position and the second specified ending position in the temporary table are returned as the query result.

[0010] The data paging query method provided by the present invention also includes: If the second specified starting position or the second specified ending position is not between the first specified ending position and the pre-read ending position, the data between the second specified starting position and the second specified ending position in the screening result set is returned as the query result.

[0011] According to the data paging query method provided by the present invention, the first end position is determined according to the sum of the values ​​of the first offset and the first page capacity; the second end position is determined according to the sum of the values ​​of the second offset and the second page capacity.

[0012] According to the data paging query method provided by the present invention, the data paging query method further includes: recording the screening condition information corresponding to the temporary table; Before returning the data between the second specified starting position and the second specified ending position in the temporary table as the query result, the method includes: Determine whether the filtering condition information corresponding to the subsequent paging query request matches the filtering condition information corresponding to the temporary table; If there is a match, the data between the second specified starting position and the second specified ending position in the temporary table is returned as the query result.

[0013] The present invention also provides a data paging query device, comprising the following modules: a prior paging query request processing module, configured to respond to a prior paging query request, return data between a first specified starting position and a first specified ending position in a screening result set as a query result, and read data between the first specified ending position and a pre-reading ending position and store them in a temporary table; the prior paging query request includes the first offset and the first page capacity, the first specified starting position is determined by the first offset, and the first specified ending position is determined by the first offset and the first page capacity; A post-paging query request processing module is used to respond to a post-paging query request and return the data between the second specified starting position and the second specified ending position in the temporary table as a query result; the post-paging query request includes the second offset and the second page capacity, the second specified starting position is determined by the second offset, and the second specified ending position is determined by the second offset and the second page capacity.

[0014] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, any of the above-mentioned data paging query methods is implemented.

[0015] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the data paging query method described above is implemented.

[0016] The present invention also provides a computer program product, including a computer program, wherein when the computer program is executed by a processor, the data paging query method described above is implemented.

[0017] The data paging query method, device, medium and computer program provided by the present invention store a certain amount of data after the data on the current page as pre-read data in a new temporary table, and first obtain data from the pre-read temporary table when processing subsequent paging query requests. The paging calculation of a large amount of data is converted into the paging calculation of a small amount of data, avoiding the scanning of a large amount of unnecessary data, which can effectively solve the problem of slow deep paging query in large data volume scenarios and improve the processing efficiency of the database management system. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0019] Figure 1 It is a flow chart of a data paging query method provided by an embodiment of the present invention.

[0020] Figure 2 It is a schematic diagram of data pre-reading provided by an embodiment of the present invention.

[0021] Figure 3 It is a schematic diagram of data acquisition based on a temporary table provided in an embodiment of the present invention.

[0022] Figure 4 It is a structural diagram of a data paging query device provided by an embodiment of the present invention.

[0023] Figure 5 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0024] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0025] Combine the following Figure 1-Figure 3 The data paging query method provided by the embodiment of the present invention is described.

[0026] Figure 1 is a flow chart of a data paging query method provided by an embodiment of the present invention, such as Figure 1 As shown, the method includes the following: Step 101, in response to a prior paging query request, return the data between a first specified starting position and a first specified ending position in a filtered result set as a query result, and read the data between the first specified ending position and the pre-read ending position and store them in a temporary table; the prior paging query request includes the first offset and the first page capacity, the first specified starting position is determined by the first offset, and the first specified ending position is determined by the first offset and the first page capacity.

[0027] Combination Figure 2 Step 101 is explained. The first offset (OFFSET) N0 in the previous paging query request is the first specified starting position; the first specified end position is obtained by adding the first offset (OFFSET) N0 and the first page capacity (LIMIT) P0, that is, Figure 2 The N1 position in the pre-reading is Figure 2 The N2 position in the table can be selected according to the actual situation. The return result of the previous paging query request is the data in the interval [N0, N1], and the data in the temporary table is the data in the interval [N1, N2].

[0028] Step 102: In response to a post-paging query request, return the data between the second specified starting position and the second specified ending position in the temporary table as a query result; the post-paging query request includes the second offset and the second page capacity, the second specified starting position is determined by the second offset, and the second specified ending position is determined by the second offset and the second page capacity.

[0029] Combination Figure 3 Step 102 is described below. In the post-page query request, the second offset position is (OFFSET) O1, and the second page capacity (LIMIT) is P1. The second specified starting position is Figure 3 The second specified end position is obtained by adding the values ​​of the second offset (OFFSET) O1 and the second page capacity (LIMIT) P1, which is Figure 3 In the post-page query, the temporary table is scanned and the N1-O1 records are skipped, and the data between [O1, O2] is obtained and returned as the query result.

[0030] The "first" and "second" in the above steps are only used to distinguish the parameters in the previous paging query request and the subsequent paging query request, and have no actual physical meaning. SQL paging query can use LIMIT and OFFSET clauses to implement paging, where the parameter corresponding to OFFSET is the offset (such as the first offset and the second offset described above), and the parameter corresponding to LIMIT is the page capacity, which indicates how many records are displayed per page (such as the first page capacity and the second page capacity described above). When paging, data is read starting from the offset, and the amount of data read is determined by the parameter page capacity corresponding to LIMIT in the SQL statement. It can be understood that the page capacity values ​​(that is, the number of records displayed per page) in the previous and subsequent paging query requests can be the same or different.

[0031] It should be noted that the application scenario targeted by the embodiment of the present invention is that after filtering the data in the database according to certain filtering conditions, data that meets the filtering conditions is obtained, which we call the filtering result set in this article. We often use paging technology to perform paging queries on the filtering result set. When the amount of data in the filtering result set is too large, the data acquisition speed is often very slow when the offset-based paging technology is used to perform deep paging on the filtering result set. When processing deep paging requests, the embodiment of the present invention pre-reads the data that the user may access next into a temporary table. When the user continues to request subsequent data, priority is given to obtaining data from the temporary table, which saves a lot of time compared to obtaining data from the filtering result set. For example, the location interval of the data stored in the temporary table is [10000 (equivalent to Figure 3 N1 point in the figure), 11000 (equivalent to Figure 3 N2 point in the post-page query request)], the location interval of the target data to be queried is [10180 (equivalent to Figure 3 O1 point in the figure), 10200 (equivalent to Figure 3 O2 in the temporary table)], if you query in the temporary table, you need to scan [10000 (equivalent to Figure 3 N1 point in the image), 10179] these 180 useless data are used to obtain the target data. If you want to query in the filtered result set, you need to scan [1 (equivalent to Figure 2 The target data can only be obtained after scanning 10179 useless data. Obviously, scanning 180 useless data will save a lot of time compared to scanning 10179 useless data. Based on this, the embodiment of the present invention can effectively solve the problem of slow deep paging query speed and improve the processing efficiency of the database management system.

[0032] In some embodiments of the present invention, while reading the data between the first specified end position and the pre-read end position and storing it in a temporary table, it is also necessary to record the starting position of the data in the temporary table (the starting point is the first specified end position, and the end point is the pre-read end position) for locating the data during subsequent paging query requests.

[0033] Specifically, when a subsequent subsequent paging query request is received, it is determined whether the second specified starting position and the second specified ending position are both located between the first specified ending position and the pre-reading ending position; if the second specified starting position and the second specified ending position are both located between the first specified ending position and the pre-reading ending position, the data between the second specified starting position and the second specified ending position in the temporary table is returned as the query result. For example, the subsequent paging query request: "SELECT * FROM my_table LIMIT 10 OFFSET 10200", the data interval in the temporary table is [10000, 11000]. First, based on the subsequent paging query request, it can be known that the second offset is 10200 and the second page capacity is 10; then the second specified starting position is 10200, and the second specified ending position is 10210. The second specified starting position 10200 and the second specified ending position 10210 are both located in the data position interval [10000, 11000] of the temporary table. At this time, the query result needs to be returned from the temporary table. However, if the target data location interval of the subsequent paging request is [12080, 12200] or [10090, 12000] (when at least one of the second specified starting position or the second specified ending position is not located in the data location interval of the temporary table), it means that the requested query data is not located in or is not completely located in the temporary table. At this time, the query results need to be returned from the filtered result set.

[0034] In some embodiments of the present invention, while reading the data between the first specified end position and the pre-read end position and storing them in the temporary table, it is also necessary to record the filtering condition information corresponding to the temporary table. The filtering condition information is the filtering condition used when filtering the data in the database to obtain the filtering result set. The purpose of recording the filtering condition information is to accurately locate the temporary table and then accurately output the paging data.

[0035] For example, based on the condition <age: 25-35and gender: female>, the filtering result set is filtered out, and the filtering condition information corresponding to the temporary table generated based on the filtering result set is <age: 25-35and gender: female>. When receiving a paging query request, it is necessary to identify whether the paging query request is a paging query request for the filtering result set of the condition <age: 25-35and gender: female>, that is, by determining whether the filtering condition information corresponding to the paging query request matches the filtering condition information corresponding to the temporary table, the accuracy of the temporary table positioning is guaranteed, and then the accuracy of the acquired data is guaranteed.

[0036] In some embodiments of the present invention, before determining whether to pre-read data into a temporary table, it is also necessary to determine whether it is deep paging, specifically, to determine whether the offset parameter requested by the previous paging query request is greater than a set threshold. If the first offset is greater than the set threshold, it is considered to be deep paging. At this time, in addition to returning the data between the first specified starting position and the first specified end position in the screening result set as the query result, the data between the first specified end position and the pre-read end position must be read and stored in the temporary table to prepare for subsequent paging query requests.

[0037] It should be noted that the earlier paging query request and the later paging query request in this embodiment are relative. For example, the third, fourth, etc. paging query requests are earlier paging query requests than the second paging query request. However, when the target data queried by a certain paging query request is no longer located in the temporary table, then the paging query request will no longer be the later paging query request described in this article, but becomes the earlier paging query request described in this article. Combined with deep paging, for example, the offset parameters in the first 20 paging query requests did not exceed the set threshold, while the offset parameter in the 21st paging query request exceeded the depth threshold. Then, in response to the 21st paging query request, in addition to returning the data between the first specified starting position and the first specified end position in the filtered result set as the query result, the data between the first specified end position and the pre-read end position in the filtered result set must be read and stored in the temporary table. At this time, the 21st paging query request is the prior paging query request described in this article, and the subsequent 22nd, 23rd, etc. can all be the subsequent paging query requests described in this article. The prerequisite is that the target data queried by these paging query requests are all in the temporary table pre-read at the time of the 21st paging query request. Once the target data of a paging query request is no longer in the above temporary table, the paging query request will no longer be the subsequent paging query request described in this article, but will become the prior paging query request described in this article. For example, in the 33rd paging query request, the target data of the 33rd paging query request is no longer in the temporary table pre-read in the 21st paging query request. At this time, the 33rd paging query request is no longer the subsequent paging query request described in this article, but becomes the prior paging query request described in this article. At this time, while obtaining the target data from the filtered result set as the result to be returned, a certain amount of data in the filtered result set must also be pre-read and stored in a new temporary table. The subsequent 33rd, 34th, and so on can all be the subsequent paging query requests described in this article. And so on, no further description is given here.

[0038] It should be emphasized that when the data in a temporary table is no longer needed, the temporary table will be discarded. No longer needed here can be understood as when the target data of the subsequent paging query request no longer exists in the temporary table. For example, in the 33rd paging query request above, the target data of its paging query request is no longer in the temporary table pre-read in the 21st paging query request. At this time, the temporary table pre-read in the 21st paging query request is determined to be no longer needed. And with the execution of the 33rd paging query request, a new temporary table will be generated.

[0039] Of course, when it is determined that a temporary table is no longer needed, it can be retained for a certain period of time (the period can be set by the system according to the actual situation) to cope with the situation that the user may query forward by paging in a short period of time. For example, the data location interval of the current temporary table is [10000, 11000], and the data location interval corresponding to the target data of the user's 21st paging query request is [10950, 11050]. At this time, the system generates a new temporary table. But for example, the location interval of the target data of the 23rd paging query request is [10900, 10950], which means that the user initiated a request for a backward paging query in a short period of time. In order to deal with this situation, we can retain the old temporary table for a certain period of time and not discard it immediately when processing the 21st paging query request.

[0040] The data paging query method provided by the embodiment of the present invention is described below with a specific example.

[0041] (1) Identify deep paging requests and pre-read data Identify deep paging. When the offset parameter in the paging request is found to be greater than the set threshold (the threshold is set by the system parameters), it is judged as deep paging.

[0042] like Figure 2 As shown, according to the traditional paging method, a specified number of records are skipped in the filtered result set according to the offset (offset), and the data after the limited number (limit) is returned as the results of this page.

[0043] A certain amount of data (set by system parameters) in the filtered result set that follows the data on this page is used as pre-read data and stored in a temporary table.

[0044] Record the filtering condition information corresponding to the temporary table and the position interval [N1, N2] in the filtering result set.

[0045] (2) When processing subsequent deep paging requests, first obtain data from the pre-read temporary table First, determine whether the target data of the paging query matches the pre-read temporary table. This includes: the data filtering conditions must be consistent with the filtering condition information of the pre-read temporary table; the queried paging data must fall within the data range of the pre-read temporary table, that is, O1>=N1 and (O1+P1)<=N2.

[0046] When the match is successful, Figure 3 As shown, data is read directly from the pre-read temporary table. The method is to skip the previous (N1-O1) data and read the subsequent P1 data as the result.

[0047] When the match fails, return to the step of "identifying deep paging requests and pre-reading data" and perform traditional query and pre-reading processing again.

[0048] The technical principle of the present invention is "trading storage space for performance". When processing a deep paging request, the data that the user may access next (by default, a certain number of data that is ranked after the current paging query result) is copied to a new temporary table (this operation is referred to as: pre-reading). When the user continues to request subsequent data, the temporary table can be directly accessed to quickly obtain the data, thus saving a lot of time required to locate the offset position. The present invention can effectively solve the problem of slow deep paging queries in large data volume scenarios by pre-reading the deep paging query results and exchanging storage space for performance, thereby improving the processing efficiency of the database management system.

[0049] The data paging query device provided by the present invention is described below. The data paging query device described below and the data paging query method described above can be referred to each other. The data paging query device includes the following modules: The prior paging query request processing module 403 is used to respond to the prior paging query request, return the data between the first specified starting position and the first specified ending position in the filtered result set as the query result, and read the data between the first specified ending position and the pre-reading ending position and store them in a temporary table; the prior paging query request includes the first offset and the first page capacity, the first specified starting position is determined by the first offset, and the first specified ending position is determined by the first offset and the first page capacity.

[0050] The post-paging query request processing module 405 is used to return the data between the second specified starting position and the second specified ending position in the temporary table as query results in response to the post-paging query request; the post-paging query request includes the second offset and the second page capacity, the second specified starting position is determined by the second offset, and the second specified ending position is determined by the second offset and the second page capacity.

[0051] In some embodiments of the present invention, the data paging query device further includes: The interval matching module 404 is used to determine whether the second specified starting position and the second specified ending position are both located between the first specified ending position and the pre-reading ending position; if the second specified starting position and the second specified ending position are both located between the first specified ending position and the pre-reading ending position, then jump to the post-paging query request processing module, and return the data between the second specified starting position and the second specified ending position in the temporary table as the query result. If the second specified starting position or the second specified ending position is not located between the first specified ending position and the pre-reading ending position, then return the data between the second specified starting position and the second specified ending position in the screening result set as the query result.

[0052] In some embodiments of the present invention, the data paging query device further includes: The deep paging identification module 401 is used to determine whether the first offset is greater than a set threshold. If the first offset is greater than the set threshold, the module jumps to the previous paging query request processing module, returns the data between the first specified starting position and the first specified ending position in the filter result set as the query result, and reads the data between the first specified ending position and the pre-read ending position and stores them in a temporary table. If the first offset is less than or equal to the set threshold, the module returns the data between the first specified starting position and the first specified ending position in the filter result set as the query result.

[0053] In some embodiments of the present invention, the data paging query device further includes: The condition matching module 402 is used to determine whether the filtering condition information corresponding to the subsequent paging query request matches the filtering condition information corresponding to the temporary table; if it matches, it jumps to the subsequent paging query request processing module and returns the data between the second specified starting position and the second specified end position in the temporary table as the query result.

[0054] Figure 5 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 5As shown, the electronic device may include: a processor 510, a communication interface 520, a memory 530 and a communication bus 540, wherein the processor 510, the communication interface 520 and the memory 530 communicate with each other through the communication bus 540. The processor 510 may call the logic instructions in the memory 530 to execute the data paging query method, the method comprising: in response to a previous paging query request, returning the data between the first specified starting position and the first specified ending position in the screening result set as the query result, and reading the data between the first specified ending position and the pre-reading ending position and storing them in a temporary table; the previous paging query request includes the first offset and the first page capacity, the first specified starting position is determined by the first offset, and the first specified ending position is determined by the first offset and the first page capacity; In response to a post-paging query request, the data between the second specified starting position and the second specified ending position in the temporary table is returned as a query result; the post-paging query request includes the second offset and the second page capacity, the second specified starting position is determined by the second offset, and the second specified ending position is determined by the second offset and the second page capacity.

[0055] As for more specific methods, please refer to the data paging query method described above, which will not be repeated here.

[0056] In addition, the logic instructions in the above-mentioned memory 530 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0057] On the other hand, the present invention further provides a computer program product, the computer program product includes a computer program, the computer program can be stored on a non-transitory computer-readable storage medium, when the computer program is executed by a processor, the computer can execute the data paging query method provided by the above methods, the method comprising: in response to a previous paging query request, returning the data between a first specified starting position and a first specified ending position in a screening result set as a query result, and reading the data between the first specified ending position and a pre-reading ending position and storing them in a temporary table; the previous paging query request includes the first offset and the first page capacity, the first specified starting position is determined by the first offset, and the first specified ending position is determined by the first offset and the first page capacity; In response to a post-paging query request, the data between the second specified starting position and the second specified ending position in the temporary table is returned as a query result; the post-paging query request includes the second offset and the second page capacity, the second specified starting position is determined by the second offset, and the second specified ending position is determined by the second offset and the second page capacity.

[0058] As for more specific methods, please refer to the data paging query method described above, which will not be repeated here.

[0059] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the data paging query method provided by the above methods is implemented, the method comprising: in response to a previous paging query request, returning data between a first specified starting position and a first specified ending position in a screening result set as a query result, and reading data between the first specified ending position and a pre-reading ending position and storing them in a temporary table; the previous paging query request includes the first offset and the first page capacity, the first specified starting position is determined by the first offset, and the first specified ending position is determined by the first offset and the first page capacity; In response to a post-paging query request, the data between the second specified starting position and the second specified ending position in the temporary table is returned as a query result; the post-paging query request includes the second offset and the second page capacity, the second specified starting position is determined by the second offset, and the second specified ending position is determined by the second offset and the second page capacity.

[0060] As for more specific methods, please refer to the data paging query method described above, which will not be repeated here.

[0061] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0062] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0063] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A data paging query method, characterized in that: include: In response to a previous paging query request, data between a first specified starting position and a first specified ending position in a screening result set are returned as query results, and data between the first specified ending position and a pre-reading ending position are read and stored in a temporary table; the previous paging query request includes the first offset and the first page capacity, the first specified starting position is determined by the first offset, and the first specified ending position is determined by the first offset and the first page capacity; In response to a post-paging query request, the data between the second specified starting position and the second specified ending position in the temporary table is returned as a query result; the post-paging query request includes the second offset and the second page capacity, the second specified starting position is determined by the second offset, and the second specified ending position is determined by the second offset and the second page capacity.

2. The data paging query method according to claim 1, characterized in that: Before returning the data between the first specified starting position and the first specified ending position in the screening result set as the query result and reading the data between the first specified ending position and the pre-read ending position and storing them in the temporary table, the method further includes: Determine whether the first offset is greater than a set threshold. If the first offset is greater than the set threshold, return the data between the first specified starting position and the first specified ending position in the filter result set as the query result, and read the data between the first specified ending position and the pre-read ending position and store them in a temporary table.

3. The data paging query method according to claim 2, characterized in that: Also includes: If the first offset is less than or equal to the set threshold, the data between the first specified starting position and the first specified ending position in the screening result set is returned as the query result.

4. The data paging query method according to claim 1, characterized in that: Before returning the data between the second specified starting position and the second specified ending position in the temporary table as the query result, the method further includes: Determining whether the second designated starting position and the second designated ending position are both located between the first designated ending position and the pre-reading ending position; If the second specified starting position and the second specified ending position are both located between the first specified ending position and the pre-read ending position, the data between the second specified starting position and the second specified ending position in the temporary table are returned as the query result.

5. The data paging query method according to claim 4, characterized in that: Also includes: If the second specified starting position or the second specified ending position is not between the first specified ending position and the pre-read ending position, the data between the second specified starting position and the second specified ending position in the screening result set is returned as the query result.

6. The data paging query method according to any one of claims 1 to 5, characterized in that: The first end position is determined according to the sum of the first offset and the first page capacity; the second end position is determined according to the sum of the second offset and the second page capacity.

7. The data paging query method according to claim 1, characterized in that: The data paging query method further includes: recording the screening condition information corresponding to the temporary table; Before returning the data between the second specified starting position and the second specified ending position in the temporary table as the query result, the method includes: Determine whether the filtering condition information corresponding to the subsequent paging query request matches the filtering condition information corresponding to the temporary table; If there is a match, the data between the second specified starting position and the second specified ending position in the temporary table is returned as the query result.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the program, the data paging query method as described in any one of claims 1 to 7 is implemented.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the data paging query method according to any one of claims 1 to 7 is implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the data paging query method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Paging query method and device for OLAP database and server

    CN117009440A

  • ElasticSearch deep paging query method and device and electronic equipment

    CN117520377A

  • Data retrieval method and device, computer equipment and storage medium

    CN117573690A

  • Method and device for realizing Elasticsearch efficient paging query based on SQL (Structured Query Language)

    CN118312535A

  • Paging query method and device, computer equipment and storage medium

    CN118606361A