Paging query method, device and equipment and machine readable storage medium
By converting the paging query conditions into a preset string and using the query information in the cached data, the query results of the subtable are directly determined, which solves the problem of large number of queries and slow speeds in paging query of the subtable store data, and realizes a more efficient query process.
Patent Information
- Application Number
- CN202410154924.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-02
- Publication Date
- 2025-08-05
AI Technical Summary
In the prior art, when the data stored in the subtable is paging query, all data that meets the query conditions need to be queried from each subtable and merged and sorted, resulting in large queries, high memory resource consumption, and slow query speed.
By converting the paging query conditions into a preset string, the query results are directly determined using the query information of the sub-table corresponding to the paging query conditions in the cached data, reducing the number of queries and merging and sorting.
It effectively reduces the number of queries, reduces the consumption of memory resources, and improves the query speed.
Smart Images

Figure CN120429318A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a paging query method, apparatus, device, and machine-readable storage medium. Background Art
[0002] As the amount of data in the database increases, when the amount of data in a single database table reaches a certain scale, it is necessary to consider storing the data in separate tables to improve the efficiency of data insertion and query. After the data is stored in separate tables, it will bring certain difficulties to paging query.
[0003] Currently, paging queries on data stored in sharded tables require searching for all data that meets the query criteria from each sharded table, merging the query results from each sharded table, and then sorting the merged data according to the sorting parameters in the query criteria to retrieve the data corresponding to the query page. This query method results in a large query volume, consumes more memory resources, and reduces query speed. Summary of the Invention
[0004] The purpose of the embodiments of the present application is to provide a paging query method, apparatus, device, and machine-readable storage medium for performing paging query on data stored in shard tables, so as to solve or at least partially solve the above-mentioned problems.
[0005] In order to achieve the above objectives, the first aspect of the present application provides a paging query method, which includes:
[0006] Get paging query conditions;
[0007] Convert the paging query condition into a first string of a preset length;
[0008] Querying the cached data for first query information of at least one corresponding sub-table according to the first character string;
[0009] In the case that the cached data contains first query information of at least one sub-table, a query result is determined according to the first query information of each sub-table.
[0010] In an embodiment of the present application, when first query information of at least one sub-table exists in the cached data, determining a query result based on the first query information of each sub-table includes:
[0011] In a case where there is first query information of at least one sub-table in the cache data, determining corresponding first query instructions of each sub-table according to the first query information of each sub-table;
[0012] Determine a first initial query result for each sub-table according to the first query instruction of each sub-table;
[0013] Merge and sort the first initial query results of each sub-table according to the paging query conditions to determine the query results.
[0014] In an embodiment of the present application, when there is at least one first query information of a sub-table in the cache data, determining the first query instructions corresponding to each sub-table according to the first query information of each sub-table includes:
[0015] When there is at least one first query information of a sub-table in the cache data, determine the first starting query position and the first number of query records corresponding to each sub-table according to the first query information of each sub-table;
[0016] Determine the first query instructions corresponding to each sub-table according to the first starting query position and the first number of query records.
[0017] In an embodiment of the present application, when there is at least one first query information of a sub-table in the cache data, the first starting query position of each sub-table is the starting query position in the first query information of each sub-table, and the first number of query records of each sub-table is the number of data in the first query information of each sub-table.
[0018] In an embodiment of the present application, the paging query method further includes:
[0019] When there is no first query information of at least one sub-table in the cache data, convert the paging query conditions into a second string with a preset length, where the second string is the string corresponding to the page number in the paging query conditions minus one;
[0020] Query the second query information of the corresponding at least one sub-table from the cache data according to the second string;
[0021] When there is at least one second query information of a sub-table in the cache data, determine the query results according to the second query information of each sub-table.
[0022] In an embodiment of the present application, when there is at least one second query information of a sub-table in the cache data, determining the query results according to the second query information of each sub-table includes:
[0023] When there is at least one second query information of a sub-table in the cache data, sequentially determine the second query instructions of each sub-table;
[0024] Determine the second initial query results of each sub-table according to the second query instructions of each sub-table;
[0025] Merge and sort the second initial query results of each sub-table according to the paging query conditions to determine the query results;
[0026] Among them, determining the second query instructions for each sub-table in sequence includes:
[0027] When there is second query information of a sub-table in the cached data, determine the second starting query position and the second query number of the corresponding sub-table according to the second query information of the sub-table, and determine the second query instruction of the corresponding sub-table according to the second starting query position and the second query number;
[0028] When there is no second query information of a sub-table in the cached data, determine the second starting query position and the second query number of the corresponding sub-table according to the paging query condition, and determine the second query instruction of the corresponding sub-table according to the second starting query position and the second query number.
[0029] In the embodiment of the present application, when there is second query information of a sub-table in the cached data, the second starting query position of the sub-table is the starting query position in the second query information of the sub-table plus the number of data, and the second query number of the sub-table is the number of data per page in the paging query condition;
[0030] When there is no second query information of a sub-table in the cached data, the second starting query position of the sub-table is the first data of the sub-table, and the second query number of the sub-table is the number of data per page in the paging query condition.
[0031] The second aspect of the present application provides a paging query device, including:
[0032] A memory configured to store instructions; and
[0033] A processor configured to call instructions from the memory and capable of implementing the paging query method as described in the first aspect when executing the instructions.
[0034] The third aspect of the present application provides a computing device, including:
[0035] The paging query device as described in the second aspect.
[0036] The fourth aspect of the present application provides a machine-readable storage medium, on which instructions are stored, and the instructions are used to make a machine execute the paging query method as described in the first aspect.
[0037] Through the above technical solutions, when performing paging query on the data stored in sub-tables, it is not necessary to query all the data that meet the query conditions from each sub-table every time and then perform merging and sorting. Instead, the query information of the sub-table corresponding to the paging query condition in the cached data is directly used to determine the query result, effectively reducing the query volume, reducing the consumption of memory resources, and at the same time improving the query speed.
[0038] Other features and advantages of the embodiments of the present application will be described in detail in the following specific implementation section. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The drawings are used to provide a further understanding of the embodiments of the present application, and constitute a part of the specification. They are used together with the following specific implementation to explain the embodiments of the present application, but do not constitute a limitation to the embodiments of the present application. In the drawings:
[0040] Figure 1 Schematically shows a flowchart of a paging query method according to an embodiment of the present application;
[0041] Figure 2 Schematically shows a structural diagram of a paging query device according to an embodiment of the present application. SPECIFIC IMPLEMENTATION
[0042] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. It should be understood that the specific implementation described herein is only used to explain and illustrate the embodiments of the present application, and is not used to limit the embodiments of the present application. 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.
[0043] It should be noted that if there are directional indications (such as up, down, left, right, front, back...) involved in the embodiments of the present application, the directional indications are only used to explain the relative positional relationship and movement conditions between components in a specific posture (as shown in the drawings). If the specific posture changes, the directional indications will also change accordingly.
[0044] In addition, if there are descriptions such as "first", "second", etc. involved in the embodiments of the present application, the descriptions of "first", "second", etc. are only for descriptive purposes, and cannot be understood as indicating or implying their relative importance or implicitly indicating the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include at least one such feature. In addition, the technical solutions between various embodiments can be combined with each other, but it must be based on the ability of those of ordinary skill in the art to implement. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the protection scope required by the present application.
[0045] Figure 1 Schematically shows a flowchart of a paging query method according to an embodiment of the present application. As Figure 1As shown in the figure, an embodiment of the present application provides a paging query method, which may include the following steps:
[0046] Step S110: Obtain paging query conditions.
[0047] It can be understood that when performing a paging query, it is first necessary to obtain paging query conditions to clarify the requirements that the queried data needs to meet. The paging query conditions may include sorting fields, sorting methods, page numbers, and the number of data items per page.
[0048] In the embodiment of the present application, taking the example that user information is stored in 5 sub-tables and querying user names from the sub-tables, the table names of the 5 sub-tables are user1, user2, user3, user4, and user5 respectively, and the paging query conditions are: name = Zhang San & age = asc & page = 5 & row = 10. The sorting field of this paging query condition is age, the sorting method is ascending order, the page number is 5, and the number of data items per page is 10. It can be understood as: among all the data in the 5 sub-tables, the data with the name Zhang San is sorted in ascending order of age, with 10 data items per page, and the data on the 5th page is queried.
[0049] Step S120: Convert the paging query conditions into a first string with a preset length.
[0050] When querying the first query information of each sub-table that meets the conditions in the cached data, it is not directly queried according to the paging query conditions, but first the paging query conditions are converted into a first string with a preset length, which ensures data format consistency and improves data security at the same time.
[0051] Specifically, in the embodiment of the present application, the paging query conditions can be converted into the corresponding md5 value, converting name = Zhang San & age = asc & page = 5 & row = 10 into md5(name = Zhang San & age = asc & page = 5 & row = 10), or the paging query conditions can be converted into other forms of strings, and the present application does not limit this.
[0052] Step S130: Query the first query information of the corresponding at least one sub-table from the cached data according to the first string.
[0053] In step S120, the first string with a preset length corresponding to the paging query conditions has been obtained, and then the first query information of the corresponding at least one sub-table can be queried from the cached data. The cached data may include the query information of the sub-tables corresponding to the historical paging query conditions, which is convenient for improving the query speed of subsequent paging queries.
[0054] In an embodiment of the present application, query whether there is cache data corresponding to md5(name = Zhang San & age = asc & page = 5 & row = 10), that is, the first query information of at least one sub-table corresponding thereto.
[0055] Step S140: When there is the first query information of at least one sub-table in the cache data, determine the query result according to the first query information of each sub-table.
[0056] When there is the first query information of at least one sub-table in the cache data, it means that there is information in the cached historical data corresponding to the current paging query condition. The first query information of each sub-table in the cache data can be directly used to determine the query result, without having to query all the data that meets the query conditions from each sub-table and then perform merging and sorting, reducing the query volume and improving the query speed to a certain extent.
[0057] Specifically, step S140 includes:
[0058] Step S141: When there is the first query information of at least one sub-table in the cache data, determine the first query instructions corresponding to each sub-table according to the first query information of each sub-table.
[0059] When there is the first query information of at least one sub-table in the cache data, first determine the first query instructions corresponding to each sub-table according to the first query information of each sub-table. The first query instruction can be the SQL query statement of the database table.
[0060] Specifically, step S141 includes:
[0061] Step S1411: When there is the first query information of at least one sub-table in the cache data, determine the first starting query position and the first query number of each sub-table according to the first query information of each sub-table.
[0062] The first query information of each sub-table in the cache data can be understood as the starting query position and the number of data of the data that meets the paging query condition in each sub-table during the previous query process. It should be noted that the starting query position and the number of data are both in accordance with the order of the data formed after sorting the data in the corresponding sub-table according to the sorting field and sorting method in the paging query condition.
[0063] Therefore, when there is the first query information of at least one sub-table in the cache data, the first starting query position and the first query number of each sub-table can be determined according to the first query information of each sub-table.
[0064] In an embodiment of the present application, when there is at least one first query information of sub-tables in the cached data, the first starting query position of each sub-table is the starting query position in the first query information of each sub-table, and the first query number of each sub-table is the number of data in the first query information of each sub-table.
[0065] Specifically, in an embodiment of the present application, assume that there is cached data corresponding to md5(name=Zhang San&age=asc&page=5&row=10), that is, there is at least one first query information of corresponding sub-tables. Read the cached data, and the data format of the first query information is as follows:
[0066]
[0067] tableName is the table name, startIndex is the starting query position (0 represents the first piece of data, and so on), count is the number of data. The above first query information can be understood as: in the sub-table with the table name user1, among the data formed by sorting the data with the name Zhang San in ascending order of age, the first 3 pieces of data starting from the first piece of data meet the paging query conditions; in the sub-table with the table name user3, among the data formed by sorting the data with the name Zhang San in ascending order of age, the 7 pieces of data starting from the third piece of data meet the paging query conditions, and there is no data in other sub-tables that meets the paging query conditions.
[0068] Thus, the first starting query position and the first query number of each sub-table can be determined. The first starting query position of the sub-table with the table name user1 is the first piece of data, and the first query number is 3 pieces. The first starting query position of the sub-table with the table name user3 is the third piece of data, and the first query number is 7 pieces.
[0069] Step S1412: Determine the first query instructions for the corresponding sub-tables according to the first starting query position and the first query number.
[0070] After determining the first starting query position and the first query number of each sub-table, the first query instructions for each sub-table can be obtained.
[0071] In an embodiment of the present application, the sub-table query is performed according to the following first query instructions:
[0072] select*from useri where name like‘%Zhang San%’order by age asc limit <startindex> , <count>
[0073] Among them, useri is the table name of the sub-table, startIndex is the starting query position in the first query information of the sub-table, and count is the number of data in the first query information of the sub-table.
[0074] Specifically, the first query instruction for the sub-table with the table name user1 is: select * from user1 where name like ‘%Zhang San%’ order by age asc limit 0, 3; the first query instruction for the sub-table with the table name user3 is: select * from user3 where name like ‘%Zhang San%’ order by age asc limit 2, 7.
[0075] Step S142: Determine the first initial query results of each sub-table according to the first query instructions of each sub-table.
[0076] In step S141, only the first query instructions of each sub-table can be obtained. It is also necessary to determine the first initial query results of each sub-table according to the first query instructions of each sub-table to obtain specific initial query data.
[0077] Specifically, the first initial query result obtained in the sub-table with the table name user1 is 3 pieces of data, and the first initial query result obtained in the sub-table with the table name user3 is 7 pieces of data.
[0078] Step S143: Merge and sort the first initial query results of each sub-table according to the paging query conditions to determine the query results.
[0079] The 10 pieces of data obtained in the two sub-tables of user1 and user3 only indicate that these 10 pieces of data belong to the data on the 5th page that meet the paging query conditions, and the order of these 10 pieces of data is uncertain. It is also necessary to merge these 10 pieces of data and sort them again in ascending order of age before the final query results can be obtained.
[0080] In the case that there is at least one first query information of a sub-table in the cached data, use the first query information to directly determine the positions of the data that meet the paging query conditions in each sub-table, obtain the first query instructions, then determine the first initial query results according to the first query instructions of each sub-table, and merge and sort the first initial query results to obtain the final query results, reducing the query volume, reducing the consumption of memory resources, and at the same time improving the query speed.
[0081] In the embodiments of the present application, the paging query method further includes:
[0082] Step S150: if the first query information of at least one sub-table does not exist in the cache data, convert the paging query condition into a second string of a preset length, wherein the second string is a string corresponding to the page number in the paging query condition minus one.
[0083] When the first query information of at least one sub-table does not exist in the cached data, it means that there is no information corresponding to the current paging query condition in the cached historical data. In this case, the query can be performed with the help of the cached data corresponding to the previous page of the page number in the paging query condition. It is also necessary to first convert the paging query condition into a second string of a preset length. Since the query is performed with the help of the cached data corresponding to the previous page of the page number in the paging query condition, the second string is the string corresponding to the page number in the paging query condition minus one.
[0084] Specifically, in an embodiment of the present application, the second string is to convert name=张三&age=asc&page=5&row=10 into md5(name=张三&age=asc&page=4&row=10). The paging query condition can also be converted into other forms of strings, which is not limited in this application.
[0085] Step S160: querying the cached data for second query information of at least one corresponding sub-table according to the second character string.
[0086] In step S150 , a second character string of a preset length corresponding to the previous page in the paging query condition has been obtained. Second query information of at least one corresponding sub-table can be queried from the cache data based on the second character string.
[0087] In the embodiment of the present application, it is queried whether there is cache data corresponding to md5(name=张三&age=asc&page=4&row=10), that is, second query information corresponding to at least one sub-table.
[0088] Step S170: when the cached data contains second query information of at least one sub-table, determining a query result according to the second query information of each sub-table.
[0089] When the second query information of at least one sub-table exists in the cached data, it means that the cached historical data contains information corresponding to the page number before the page number in the current paging query condition. The second query information of each sub-table in the cached data can be directly used to determine the query result. Similarly, there is no need to query all data that meets the query condition from each sub-table and then merge and sort them, which reduces the query volume and improves the query speed to a certain extent.
[0090] Specifically, step S170 includes:
[0091] Step S171: When there is at least one second query information of a sub-table in the cached data, determine the second query instructions of each sub-table in sequence.
[0092] When there is at least one second query information of a sub-table in the cached data, it is first necessary to determine the second query instructions of each sub-table in sequence. The second query instruction can be an SQL query statement of a database table.
[0093] It can be understood that there may not be data corresponding to the previous page of the page number in the paging query condition in all sub-tables. That is to say, there may not be second query information of all sub-tables in the cached data.
[0094] Therefore, determining the second query instructions of each sub-table in sequence includes:
[0095] When there is second query information of a sub-table in the cached data, determine the second starting query position and the second query number of the corresponding sub-table according to the second query information of the sub-table, and determine the second query instruction of the corresponding sub-table according to the second starting query position and the second query number.
[0096] When there is second query information of a sub-table in the cached data, the second query information corresponds to the data of the previous page that meets the current paging query condition. Therefore, to obtain the data of the current page that meets the current paging query condition, it is necessary to determine the second starting query position and the second query number of the corresponding sub-table according to the second query information of the sub-table, and determine the second query instruction of the corresponding sub-table according to the second starting query position and the second query number.
[0097] In the embodiment of the present application, when there is second query information of a sub-table in the cached data, the second starting query position of the sub-table is the starting query position in the second query information of the sub-table plus the number of data, and the second query number of the sub-table is the number of data per page in the paging query condition.
[0098] It should be noted that the second query information corresponds to the data of the previous page that meets the current paging query condition. To obtain the data of the current page that meets the current paging query condition, the second starting query position of the sub-table should be the starting query position in the second query information of the sub-table plus the number of data. Also, since the number of data of the current page that meets the current paging query condition cannot be determined, the second query number of the sub-table should be the number of data per page in the paging query condition.
[0099] Specifically, in the embodiment of the present application, when there is second query information of a sub-table in the cached data, perform sub-table query according to the following second query instruction:
[0100] select*from useri where name like‘%Zhang San%’order by age asc limit<startIndex+count>, <row>
[0101] Where useri is the table name of the sub - table, startIndex is the starting query position in the second query information of the sub - table, count is the number of data in the second query information of the sub - table, and row is the number of data per page in the paging query condition.
[0102] In the case where the second query information of the sub - table does not exist in the cached data, determine the second starting query position and the second query count of the corresponding sub - table according to the paging query condition, and determine the second query instruction of the corresponding sub - table according to the second starting query position and the second query count.
[0103] In the case where the second query information of the sub - table does not exist in the cached data, the second starting query position of the sub - table is the first data of the sub - table, and the second query count of the sub - table is the number of data per page in the paging query condition.
[0104] It can be understood that in the case where the second query information of the sub - table does not exist in the cached data, it only means that there is no data in the previous page that meets the current paging query condition in the sub - table, and it cannot be determined whether there is data in the current page that meets the current paging query condition in the sub - table. Therefore, the second starting query position of the sub - table is the first data of the sub - table, and the second query count of the sub - table is the number of data per page in the paging query condition.
[0105] Specifically, in the embodiment of the present application, in the case where the second query information of the sub - table does not exist in the cached data, perform sub - table query according to the following second query instruction:
[0106] select*from useri where name like‘%Zhang San%’order by age asc limit 0, <row>
[0107] Where useri is the name of the sharded table, and row is the number of data entries per page in the paging query condition.
[0108] Step S172: determining the second initial query result of each sub-table according to the second query instruction of each sub-table.
[0109] After obtaining the second query instruction of each sub-table, the second initial query result of each sub-table is further determined according to the second query instruction of each sub-table.
[0110] Step S173: Merge and sort the second initial query results of each sub-table according to the paging query condition to determine the query result.
[0111] After obtaining the second initial query result, it is necessary to merge and sort the second initial query result according to the sorting field and sorting method in the paging query condition, and take the first row of data after sorting, where row is equal to the number of data per page in the paging query condition. At this point, the final query result is obtained.
[0112] It should be noted that after completing this paging query, the results of this paging query can be cached according to the above-mentioned first query information data format, and the starting query position and number of data items in each sub-table that meet the conditions of this paging query can be cached, so that when the same paging query conditions are used for subsequent queries, the cached data can be directly read, thereby improving the query speed.
[0113] In addition, when the first query information of at least one sub-table does not exist in the cache data and when the second query information of at least one sub-table does not exist in the cache data, a sub-table query is performed for each sub-table according to the following query instruction:
[0114] select*from useri where name like'%张三%'order by age asc limit 0,<page*row>
[0115] Among them, useri is the table name of the sharded table, page is the page number in the paging query condition, and row is the number of data entries per page in the paging query condition.
[0116] After obtaining the initial query results of each sub-table, merge and sort the initial query results of each sub-table, and take the sorted data from (page-1)*row to page*row as the final query result. At the same time, the paging query results need to be cached according to the first query information data format mentioned above.
[0117] The paging query method provided by the embodiments of the present application, when performing paging query on data stored in sub-tables, does not need to query all the data that meet the query conditions from each sub-table every time and then perform merging and sorting. Instead, it directly determines the query result by using the query information of the sub-table corresponding to the paging query condition in the cached data, effectively reducing the query volume, reducing the consumption of memory resources, and at the same time improving the query speed.
[0118] Figure 2 Schematically shows a structural diagram of a paging query device according to an embodiment of the present application. As Figure 2 shown, an embodiment of the present application provides a paging query device 200, which may include:
[0119] A memory 210, configured to store instructions; and
[0120] A processor 220, configured to call instructions from the memory 210 and be able to implement the above-mentioned paging query method when executing the instructions.
[0121] The paging query device provided by the embodiments of the present application can implement each process of the paging query method in the method embodiments and can achieve the same technical effects. To avoid repetition, it will not be elaborated here.
[0122] An embodiment of the present application further provides a computing device, which may include the above-mentioned paging query device.
[0123] An embodiment of the present application further provides a machine-readable storage medium, on which instructions are stored, and the instructions are used to make a machine execute the above-mentioned paging query method.
[0124] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0125] The present application is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, and the combination of processes and / or blocks in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate for implementing in the process Figure 1 a process or processes and / or blocks Figure 1 means for the functions specified in a block or blocks.
[0126] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce a manufacture including an instruction means that implements the functions in the process Figure 1 a process or processes and / or blocks Figure 1 specified in a block or blocks.
[0127] These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus, such that a series of operational steps are performed on the computer or other programmable apparatus to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable apparatus provide steps for implementing the functions in the process Figure 1 a process or processes and / or blocks Figure 1 specified in a block or blocks.
[0128] In a typical configuration, a computing device includes one or more processors (CPUs), an input / output interface, a network interface, and memory.
[0129] The memory may include non-permanent memory in the form of computer-readable media, random access memory (RAM) and / or non-volatile memory such as read-only memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
[0130] Computer-readable media includes both permanent and non-permanent, removable and non-removable media implemented by any method or technology for storage of information. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile discs (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media such as modulated data signals and carrier waves.
[0131] It should also be noted that the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, commodity or device comprising a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, method, commodity or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, commodity or device comprising the element.
[0132] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, various changes and modifications can be made to the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.< / row> < / row> < / count> < / startindex>
Claims
1. A paging query method, characterized in that: include: Get paging query conditions; Converting the paging query condition into a first character string of a preset length; querying first query information of at least one corresponding sub-table from cached data according to the first character string; In a case where the first query information of the at least one sub-table exists in the cache data, a query result is determined according to the first query information of each sub-table.
2. The paging query method according to claim 1, characterized in that: When the first query information of the at least one sub-table exists in the cache data, determining the query result according to the first query information of each sub-table includes: In a case where the first query information of the at least one sub-table exists in the cache data, determining the corresponding first query instructions of each sub-table according to the first query information of each sub-table; Determine a first initial query result for each sub-table according to the first query instruction for each sub-table; The first initial query results of each sub-table are merged and sorted according to the paging query condition to determine the query result.
3. The paging query method according to claim 2, characterized in that: When the first query information of the at least one sub-table exists in the cache data, determining the corresponding first query instructions of each sub-table according to the first query information of each sub-table includes: When the first query information of the at least one sub-table exists in the cache data, determining the first starting query position and the number of first query entries of each sub-table according to the first query information of each sub-table; The first query instruction corresponding to each of the sub-tables is determined according to the first starting query position and the first query number.
4. The paging query method according to claim 3, characterized in that: When the first query information of the at least one sub-table exists in the cache data, the first starting query position of each sub-table is the starting query position in the first query information of each sub-table, and the first query number of each sub-table is the number of data items in the first query information of each sub-table.
5. The paging query method according to claim 1, characterized in that: Also includes: If the first query information of the at least one sub-table does not exist in the cache data, converting the paging query condition into a second character string of a preset length, wherein the second character string is a character string corresponding to the page number in the paging query condition minus one; querying the cached data for second query information of at least one corresponding sub-table according to the second character string; In a case where the second query information of the at least one sub-table exists in the cache data, a query result is determined according to the second query information of each sub-table.
6. The paging query method according to claim 5, characterized in that: When the second query information of the at least one sub-table exists in the cache data, determining the query result according to the second query information of each sub-table includes: In a case where the second query information of the at least one sub-table exists in the cache data, determining the second query instruction of each sub-table in sequence; Determine a second initial query result for each sub-table according to the second query instruction for each sub-table; Merge and sort the second initial query results of each sub-table according to the paging query condition to determine the query result; The second query instruction for sequentially determining each sub-table includes: If the second query information of the sub-table exists in the cache data, determining a second starting query position and a second query number of the corresponding sub-table according to the second query information of the sub-table, and determining a second query instruction of the corresponding sub-table according to the second starting query position and the second query number; When the second query information of the sub-table does not exist in the cache data, the second starting query position and the second query number of the corresponding sub-table are determined according to the paging query condition, and the second query instruction of the corresponding sub-table is determined according to the second starting query position and the second query number.
7. The paging query method according to claim 6, characterized in that: If the second query information of the sub-table exists in the cache data, the second starting query position of the sub-table is the starting query position in the second query information of the sub-table plus the number of data items, and the second query number of the sub-table is the number of data items per page in the paging query condition; When the second query information of the sub-table does not exist in the cache data, the second starting query position of the sub-table is the first data of the sub-table, and the second query number of the sub-table is the number of data per page in the paging query condition.
8. A paging query device, characterized in that: include: a memory configured to store instructions; as well as A processor is configured to call the instruction from the memory and implement the paging query method according to any one of claims 1 to 7 when executing the instruction.
9. A computing device, characterized in that include: The paging query device according to claim 8.
10. A machine-readable storage medium, characterized in that The machine-readable storage medium stores instructions, which are used to enable a machine to execute the paging query method according to any one of claims 1 to 7.