Data query method and device based on table structure cache

By adopting the data query method of table structure cache in the cache, the problems of high cache maintenance complexity and low query efficiency in the existing technology are solved, and more efficient data query is achieved.

CN117891843BActive Publication Date: 2025-05-06YUSUR TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311808356.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-26
Publication Date
2025-05-06
Estimated Expiration
2043-12-26

AI Technical Summary

Technical Problem

In the prior art, the maintenance complexity of the cache is high, and the efficiency of querying data in the cache is not high, especially when the linked list is long, the query hit time is longer.

Method used

The data query method based on the table structure cache is adopted. Multiple tag addresses are queried in the tag address table in the cache through the table number entered by the user, and the tags are queried in sequence until they correspond to the target data table entry number, and the target user data is queried in the data table.

Benefits of technology

It effectively reduces the maintenance complexity of cache and improves the efficiency of querying data in cache.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117891843B_ABST
    Figure CN117891843B_ABST
Patent Text Reader

Abstract

The present application provides a data query method and device based on table structure cache, the method comprising: querying in a label address table pre-set in the cache based on the table number input by the user to obtain multiple label addresses corresponding to the table number; sequentially querying multiple labels corresponding to each of the label addresses from the label table pre-set in the cache until the label corresponds to the target data table item number input by the user; querying in a data table pre-set in the cache based on the label corresponding to the target data table item number to obtain the target user data. The present application can effectively reduce the complexity of cache maintenance and improve the efficiency of querying data in the cache.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data query, and in particular to a data query method and device based on table structure cache. Background Art

[0002] When the hardware needs to access data in DDR, if the bandwidth difference between the two is large, a cache needs to be added between the two to achieve the purpose of fast read response to the hardware. However, the cache resources are generally not very large. When the data stored in the cache has filled the storage space of the cache, the data in the cache needs to be replaced with DDR to achieve the purpose of storing new data in the cache. However, the replacement strategies used for different situations are also different. For the situation where the same data block will be accessed in a short period of time,

[0003] The most commonly used algorithm in the prior art is the LRU algorithm, but the LRU algorithm is implemented using a bidirectional linked list, and the maintenance of the bidirectional linked list is relatively complex. When the linked list is relatively long, the query hit time will also be relatively long. Summary of the invention

[0004] In view of this, an embodiment of the present application provides a data query method and device based on table structure cache to eliminate or improve one or more defects existing in the prior art.

[0005] A first aspect of the present application provides a data query method based on table structure cache, the method comprising:

[0006] Based on the table number input by the user, a query is performed in a label address table pre-set in the cache to obtain a plurality of label addresses corresponding to the table number;

[0007] sequentially querying a plurality of labels corresponding to each of the label addresses from a label table pre-set in the cache until the label corresponds to the target data table item number input by the user;

[0008] Based on the tag corresponding to the target data table item number, a query is performed in a data table pre-set in the cache to obtain the target user data.

[0009] In some embodiments of the present application, before searching the label address table pre-set in the cache based on the table number input by the user to obtain multiple label addresses corresponding to the table number, the method further includes:

[0010] Query the label address corresponding to each user data in the user table from the label address table;

[0011] Based on the label addresses corresponding to the respective user data, query the label table for the labels corresponding to the respective user data;

[0012] Each of the user data is stored in a corresponding position in the data table based on a label corresponding to each of the user data.

[0013] In some embodiments of the present application, after querying the data table pre-set in the cache to obtain the target user data based on the tag corresponding to the target data table item number, the method further includes:

[0014] The label addresses are sorted, and the label address corresponding to the target user data is placed first.

[0015] In some embodiments of the present application, after querying the data table pre-set in the cache to obtain the target user data based on the tag corresponding to the target data table item number, the method further includes:

[0016] Sort multiple labels in the label address corresponding to the target user data, and put the label corresponding to the target user data at the first place.

[0017] In some embodiments of the present application, after querying the data table pre-set in the cache to obtain the target user data based on the tag corresponding to the target data table item number, the method further includes:

[0018] If the data table overflows, the user data in the data table corresponding to each tag in the tag address ranked last in the tag address table is replaced with the user data in the DDR.

[0019] In some embodiments of the present application, the tag includes: an entry number, a mapping value, and a valid value;

[0020] The table entry number is used for verification with the target data table entry number;

[0021] The mapping value is used to index the position of the entry number in the data table;

[0022] The valid value is used to determine whether the entry number is valid.

[0023] A second aspect of the present application provides a data query device based on table structure cache, the device comprising:

[0024] A label address query module, used to query a label address table pre-set in the cache based on a table number input by a user to obtain a plurality of label addresses;

[0025] A tag query module, used to query a plurality of tags corresponding to each of the tag addresses in sequence from a tag table pre-set in the cache, until the tag corresponds to the target data table item number input by the user;

[0026] The data query module is used to query the data table pre-set in the cache based on the tag corresponding to the target data table item number to obtain the target user data.

[0027] In some embodiments of the present application, it also includes:

[0028] The label address sorting module is used to sort the label addresses and put the label address corresponding to the target user data in the first place.

[0029] In some embodiments of the present application, it also includes:

[0030] The label sorting module is used to sort the multiple labels in the label address corresponding to the target user data, and put the label corresponding to the target user data in the first place.

[0031] A third aspect of the present application provides a DPU, which is used to execute the data query method based on table structure cache described in the first aspect.

[0032] The present application provides a data query method and device based on table structure cache, the method comprising: querying in a label address table pre-set in the cache based on the table number input by the user to obtain multiple label addresses corresponding to the table number; sequentially querying multiple labels corresponding to each of the label addresses from the label table pre-set in the cache until the label corresponds to the target data table item number input by the user; querying in a data table pre-set in the cache based on the label corresponding to the target data table item number to obtain the target user data. The present application can effectively reduce the complexity of cache maintenance and improve the efficiency of querying data in the cache.

[0033] Additional advantages, purposes, and features of the present application will be partially described in the following description, and will become partially apparent to those skilled in the art after studying the following, or may be learned from the practice of the present application. The purposes and other advantages of the present application can be achieved and obtained by the structures specifically pointed out in the specification and the drawings.

[0034] Those skilled in the art will understand that the purposes and advantages that can be achieved by the present application are not limited to the above specific description, and the above and other purposes that can be achieved by the present application will be more clearly understood based on the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] The drawings described herein are used to provide a further understanding of the present application, constitute a part of the present application, and do not constitute a limitation of the present application. The components in the drawings are not drawn to scale, but are only for the purpose of illustrating the principles of the present application. In order to facilitate the illustration and description of some parts of the present application, the corresponding parts in the drawings may be enlarged, that is, they may become larger relative to other components in the exemplary device actually manufactured according to the present application. In the drawings:

[0036] Figure 1 The figure is a flowchart of a data query method based on table structure cache in one embodiment of the present application.

[0037] Figure 2 It is a structural diagram of a data query device based on table structure cache in another embodiment of the present application.

[0038] Figure 3 The present invention is a flowchart of a data storage method based on table structure cache in one embodiment of the present application. DETAILED DESCRIPTION

[0039] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the implementation modes and the accompanying drawings. Here, the illustrative implementation modes and descriptions of the present application are used to explain the present application, but are not intended to limit the present application.

[0040] It should also be noted here that in order to avoid obscuring the present application due to unnecessary details, only the structures and / or processing steps closely related to the scheme according to the present application are shown in the accompanying drawings, while other details that are not very relevant to the present application are omitted.

[0041] It should be emphasized that the term “include / comprises” when used herein refers to the presence of features, elements, steps or components, but does not exclude the presence or addition of one or more other features, elements, steps or components.

[0042] It should also be noted that, unless otherwise specified, the term “connection” herein may refer not only to a direct connection but also to an indirect connection involving an intermediate.

[0043] Hereinafter, embodiments of the present application will be described with reference to the accompanying drawings. In the accompanying drawings, the same reference numerals represent the same or similar components, or the same or similar steps.

[0044] The details are described in detail through the following examples.

[0045] The present application embodiment provides a data query method based on table structure cache that can be executed by a data query device or DPU based on table structure cache, see Figure 1The data query method based on table structure cache specifically includes the following contents:

[0046] Step 110: Based on the table number input by the user, a query is performed in a label address table pre-set in the cache to obtain a plurality of label addresses corresponding to the table number.

[0047] Step 120: sequentially query multiple tags corresponding to each of the tag addresses from a tag table pre-set in the cache until the tag corresponds to the target data entry number input by the user.

[0048] Step 130: Based on the tag corresponding to the target data table item number, query in a data table pre-set in the cache to obtain target user data.

[0049] Specifically, the DPU queries the label address table pre-set in the cache based on the table number input by the user to obtain multiple label addresses corresponding to the table number. Then, the multiple labels corresponding to each of the label addresses are queried in sequence from the label table pre-set in the cache until the label corresponds to the target data table item number input by the user. Finally, based on the label corresponding to the target data table item number, a query is performed in the data table pre-set in the cache to obtain the target user data, thereby effectively reducing the complexity of cache maintenance and improving the efficiency of querying data in the cache.

[0050] The tag address table is shown in Table 1, where table0-n corresponds to the table number input by the user, and tag_way0-n represents the tag address.

[0051] The label table is shown in Table 2, where table0-way0 to tablen-wayn represent tag_way0-n corresponding to each of table0-n; wherein the label includes: a table item number (tag), a mapping value (index) and a valid value (flag); the table item number is used for verification with the target data table item number; the mapping value is used to index the position of the table item number in the data table; and the valid value is used to determine whether the table item number is valid.

[0052] The data table is shown in Table 3. data-base0-n represents data table 0-n, where data_len represents the byte size of the data.

[0053] Table 1

[0054] table0 tag_wayn tag_wayn-1 tag_wayn-2 ...... tag_way0 table1 tag_wayn tag_wayn-1 tag_wayn-2 ...... tag_way0 ...... ...... ...... ...... ...... ...... tablen tag_wayn tag_wayn-1 tag_wayn-2 ...... tag_way0

[0055] Table 2

[0056] table0-way0 {tag, index, flag}7 {tag, index, flag}6 ....... {tag, index, flag}0 table0-way1 {tag, index, flag}7 {tag, index, flag}6 ....... {tag, index, flag}0 ...... ...... ...... ...... ...... tablen-wayn-1 {tag, index, flag}7 {tag, index, flag}6 ....... {tag, index, flag}0 tablen-wayn {tag, index, flag}7 {tag, index, flag}6 ....... {tag, index, flag}0

[0057] Table 3

[0058] data-base0 {datan, datan-1...data1, data0} data_len = 4B data-base1 {datan, datan-1...data1, data0} data_len = 8B ...... ...... ...... data-basen {datan, datan-1...data1, data0} data_len = 32B

[0059] In order to improve the efficiency of storing data in the cache, before step 110, the following steps are further included:

[0060] Step 107: Query the label address corresponding to each user data in the user table from the label address table;

[0061] Step 108: query the label table for the label corresponding to each of the user data based on the label address corresponding to each of the user data.

[0062] Step 109: storing each of the user data into a corresponding position in the data table based on the label corresponding to each of the user data.

[0063] Specifically, the DPU queries the label address corresponding to each user data in the user table from the label address table; then, based on the label address corresponding to each user data, the DPU queries the label table for the label corresponding to each user data; finally, based on the label corresponding to each user data, the DPU stores each user data in the corresponding position in the data table, thereby effectively improving the efficiency of storing data in the cache.

[0064] In order to improve the speed of searching for data in the Cache, after step 130, the following steps are further included:

[0065] The label addresses are sorted, and the label address corresponding to the target user data is placed first.

[0066] Specifically, the DPU sorts the tag addresses and puts the tag address corresponding to the target user data first, that is, the tag address corresponding to the most recently accessed target user data is put first, thereby effectively improving the speed of querying data in the cache.

[0067] In order to further improve the speed of searching for data in the Cache, after step 130, the following steps are further included:

[0068] Sort multiple labels in the label address corresponding to the target user data, and put the label corresponding to the target user data at the first place.

[0069] Specifically, the DPU sorts multiple tags in the tag address corresponding to the target user data and puts the tag corresponding to the target user data in the first place, thereby further effectively improving the speed of querying data in the cache.

[0070] In order to improve the efficiency of data replacement between Cache and DDR, after step 130, if the data table overflows, the user data in the data table corresponding to each tag in the last tag address in the tag address table is replaced with the user data in the DDR.

[0071] Specifically, if there is an overflow in the data table, the DPU will replace the user data in the data table corresponding to each tag in the last tag address in the tag address table with the user data in DDR (Double Data Rate Synchronous Dynamic Random Access Memory), thereby effectively improving the efficiency of data replacement between Cache and DDR.

[0072] From the software level, the present application also provides a data query device based on table structure cache for executing all or part of the data query method based on table structure cache, see Figure 2 The data query device based on table structure cache specifically includes the following contents:

[0073] The label address query module 10 is used to query the label address table pre-set in the cache based on the table number input by the user to obtain multiple label addresses.

[0074] The tag query module 20 is used to query the multiple tags corresponding to each of the tag addresses in sequence from the tag table pre-set in the cache until the tag corresponds to the target data table item number input by the user.

[0075] The data query module 30 is used to query the data table pre-set in the cache to obtain the target user data based on the tag corresponding to the target data table item number.

[0076] In some embodiments of the present application, the aforementioned data query device based on table structure cache further includes:

[0077] The label address sorting module is used to sort the label addresses and put the label address corresponding to the target user data in the first place.

[0078] In some embodiments of the present application, the aforementioned data query device based on table structure cache further includes:

[0079] The label sorting module is used to sort the multiple labels in the label address corresponding to the target user data, and put the label corresponding to the target user data in the first place.

[0080] The embodiment of the data query device based on table structure cache provided in the present application can be specifically used to execute the processing flow of the embodiment of the data query method based on table structure cache in the above-mentioned embodiment. Its functions will not be repeated here, and reference can be made to the detailed description of the above-mentioned embodiment of the data query method based on table structure cache.

[0081] The present application provides a data query device based on table structure cache, and the method executed by the device includes: querying in a label address table pre-set in the cache based on the table number input by the user to obtain multiple label addresses corresponding to the table number; querying multiple labels corresponding to each of the label addresses in the label table pre-set in the cache in sequence until the label corresponds to the target data table item number input by the user; querying in a data table pre-set in the cache based on the label corresponding to the target data table item number to obtain the target user data. The present application can effectively reduce the complexity of cache maintenance and improve the efficiency of querying data in the cache.

[0082] The present application also provides a DPU, which is used for the aforementioned data query method based on table structure cache.

[0083] It should be understood by those skilled in the art that the exemplary components, systems and methods described in conjunction with the embodiments disclosed herein can be implemented in hardware, software or a combination of the two. Whether it is specifically performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link via a data signal carried in a carrier.

[0084] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.

[0085] In the present application, features described and / or illustrated for one embodiment may be used in the same manner or in a similar manner in one or more other embodiments, and / or combined with features of other embodiments or replace features of other embodiments.

[0086] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the embodiments of the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A data query method based on table structure cache, executed by DPU, characterized in that: include: Based on the table number input by the user, a query is performed in a label address table pre-set in the cache to obtain a plurality of label addresses corresponding to the table number; A plurality of labels corresponding to each of the label addresses are sequentially queried from a label table pre-set in the cache until the label corresponds to the target data table item number input by the user; the label comprises: an item number, a mapping value and a valid value; the item number is used to verify the target data table item number; the mapping value is used to index the position of the item number in the data table; the valid value is used to determine whether the item number is valid; Based on the tag corresponding to the target data table item number, a query is performed in a data table pre-set in the cache to obtain the target user data.

2. The data query method based on table structure cache according to claim 1 is characterized in that: Before searching the label address table pre-set in the cache based on the table number input by the user to obtain a plurality of label addresses corresponding to the table number, the method further includes: Query the label address corresponding to each user data in the user table from the label address table; Based on the label addresses corresponding to the respective user data, query the label table for the labels corresponding to the respective user data; Each of the user data is stored in a corresponding position in the data table based on a label corresponding to each of the user data.

3. The data query method based on table structure cache according to claim 1 is characterized in that: After querying the data table pre-set in the cache to obtain the target user data based on the tag corresponding to the target data table item number, the method further includes: The label addresses are sorted, and the label address corresponding to the target user data is placed first.

4. The data query method based on table structure cache according to claim 1 is characterized in that: After querying the data table pre-set in the cache to obtain the target user data based on the tag corresponding to the target data table item number, the method further includes: Sort multiple labels in the label address corresponding to the target user data, and put the label corresponding to the target user data at the first place.

5. The data query method based on table structure cache according to claim 1 is characterized in that: After querying the data table pre-set in the cache to obtain the target user data based on the tag corresponding to the target data table item number, the method further includes: If the data table overflows, the user data in the data table corresponding to each tag in the tag address ranked last in the tag address table is replaced with the user data in the DDR.

6. A data query device based on table structure cache, characterized in that: include: A label address query module, used to query a label address table pre-set in the cache based on a table number input by a user to obtain a plurality of label addresses; The tag query module is used to query the multiple tags corresponding to each of the tag addresses in sequence from the tag table pre-set in the cache until the tag corresponds to the target data table item number input by the user; the tag includes: an item number, a mapping value and a valid value; the item number is used to verify with the target data table item number; the mapping value is used to index the position of the item number in the data table; the valid value is used to determine whether the item number is valid; The data query module is used to query the data table pre-set in the cache based on the tag corresponding to the target data table item number to obtain the target user data.

7. The data query device based on table structure cache according to claim 6 is characterized in that: Also includes: The label address sorting module is used to sort the label addresses and put the label address corresponding to the target user data in the first place.

8. The data query device based on table structure cache according to claim 6, characterized in that: Also includes: The label sorting module is used to sort the multiple labels in the label address corresponding to the target user data, and put the label corresponding to the target user data in the first place.

9. A DPU, characterized in that: The DPU is used to execute the data query method based on table structure cache as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Cache protection method and device based on dynamic mapping mechanism

    CN111414321A

  • Address and instruction cache adaptive fusion method and device

    CN114116537A