Data query method and device, medium and product
By storing mapped and compressed bitmap data in memory, the inefficiency of traditional data query methods is solved, enabling fast and efficient data querying, which is suitable for large-scale ERP and basic data query scenarios.
Patent Information
- Application Number
- CN202511925407.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-18
- Publication Date
- 2026-03-27
AI Technical Summary
Traditional data query methods are inefficient in ERP and large-scale basic data query scenarios, and cannot efficiently handle query requests for massive amounts of data.
By mapping and compressing basic data from the database into bitmap data stored in memory, and using the bitmap data for efficient matching and querying, the database filtering process is reduced, thus enabling fast and efficient data querying.
Under conditions of large data volumes and multidimensional queries, it significantly improves query speed and efficiency, reduces memory usage, and ensures the real-time nature and accuracy of query results.
Smart Images

Figure CN121743365A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data query technology, and in particular to a data query method, device, medium and product. Background Technology
[0002] In ERP (Enterprise Resource Planning) and large-scale basic data query scenarios, it is necessary to frequently query from massive amounts of data to obtain the target query data.
[0003] Traditional data query methods typically construct the key fields of the data into an ordered tree structure. During the query, the target data location is located by traversing the index tree, and the corresponding record is read from the disk or memory. Alternatively, all or core basic data can be loaded into memory, and the data structure can be optimized through skip lists or ordered sets to achieve data query.
[0004] However, traditional data query methods suffer from low query efficiency. Summary of the Invention
[0005] Therefore, it is necessary to provide a data query method, device, medium, and product that can improve query efficiency in response to the above-mentioned technical problems.
[0006] Firstly, this application provides a data query method, including:
[0007] Receive a query request, which includes at least one query attribute;
[0008] Each query attribute is matched with the memory attributes in memory to obtain the matching memory attributes. Then, the target subject identifier is obtained by using the bitmap data corresponding to the matching memory attributes. The bitmap data is the data that is stored in the memory attributes in the form of bitmap after mapping and compressing the basic data of multiple attributes in the database.
[0009] Based on the target subject identifier, determine the target query data corresponding to the query request from the database.
[0010] In one embodiment, the target subject identifier is obtained using bitmap data corresponding to the matched memory attributes, including:
[0011] Memory bitmap calculations are performed on the bitmap data corresponding to the matched memory attributes to obtain multiple target bitmap indices;
[0012] Based on the preset mapping relationship between bitmap indexes and subject identifiers, memory mapping processing is performed on multiple target bitmap indexes to obtain target subject identifiers.
[0013] In one embodiment, based on the target subject identifier, the target query data corresponding to the query request is determined from the database, including:
[0014] The database is initially filtered using the target subject identifier to obtain candidate query information;
[0015] The target query data corresponding to the query request is determined from the candidate query information by using at least one query attribute that does not match the memory attribute.
[0016] In one embodiment, before matching each query attribute with memory attributes in memory to obtain the matching memory attribute, the method further includes:
[0017] Get the memory view corresponding to the memory location;
[0018] Based on the query request, the memory view is inspected and processed to obtain the memory view inspection results;
[0019] If the memory view check result indicates that it is ready, then use memory as the data source.
[0020] In one embodiment, the memory view includes a memory version number and multiple memory attributes. Based on a query request, the memory view is inspected to obtain the memory view inspection results, including:
[0021] Search for each query attribute among multiple memory attributes to obtain the attribute search results;
[0022] If the attribute lookup result is successful, retrieve the database version number from the database;
[0023] Perform a consistency comparison between the database version number and the memory version number to obtain the comparison result;
[0024] If the comparison results are consistent, the memory view check result is determined to be ready.
[0025] In one embodiment, the method further includes:
[0026] If the memory view check result is not ready, use the database as the data source;
[0027] Based on each query attribute, the basic data in the database is filtered to obtain the target query data.
[0028] In one embodiment, the method further includes:
[0029] The target query data is mapped and compressed to obtain the bitmap data corresponding to the target query data.
[0030] The bitmap data stored in memory is updated using the bitmap data corresponding to the target query data to obtain the updated bitmap data.
[0031] Secondly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the data query method as described in the first aspect.
[0032] Thirdly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the data query method as described in the first aspect.
[0033] Fourthly, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the data query method as described in the first aspect.
[0034] The aforementioned data query methods, devices, media, and products map and compress the basic data stored in the database and store it in memory as bitmap data. This enables efficient compression of the basic data, effectively reducing memory usage. When responding to a query request, the target subject identifier can be quickly determined from the bitmap data stored in memory, and then the target query data can be obtained from the database. In this way, by transforming the traditional filtering process of a large number of subjects in the database into efficient bit operations, fast, efficient, and low-latency data queries can be achieved in memory in business scenarios with large data volumes, multi-dimensional query conditions, and frequent changes. This effectively reduces query complexity, speeds up queries, and improves data query efficiency. Attached Figure Description
[0035] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0036] Figure 1 This is a diagram illustrating the application environment of a data query method in one embodiment.
[0037] Figure 2 This is a flowchart illustrating a data query method in one embodiment;
[0038] Figure 3 This is a schematic diagram of memory attributes and bitmaps in one embodiment;
[0039] Figure 4 This is a schematic diagram of another memory attribute and bitmap in one embodiment;
[0040] Figure 5 This is a flowchart illustrating the steps for obtaining the target subject identifier in one embodiment;
[0041] Figure 6 This is a flowchart illustrating the data query method in another embodiment;
[0042] Figure 7 This is a structural block diagram of a data query device in one embodiment;
[0043] Figure 8 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0044] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0045] It should be noted that the terms "first," "second," etc., used in this application can be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion. The term "multiple" used in this application refers to two or more. The term "and / or" used in this application refers to one of the embodiments, or any combination of multiple embodiments.
[0046] The data query method provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, client 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104 or placed in the cloud or on another network server. Server 104 receives query requests sent by client 102, each query request including at least one query attribute; it matches each query attribute with memory attributes in memory to obtain matching memory attributes; using the bitmap data corresponding to the matching memory attributes, it obtains the target subject identifier. The bitmap data is data that is mapped and compressed from the basic data of multiple attributes in the database and stored in bitmap form under each memory attribute; based on the target subject identifier, it determines the target query data corresponding to the query request from the database.
[0047] Client 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, drones, low-altitude aircraft, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, and projection equipment. Portable wearable devices can include smartwatches, smart bracelets, and head-mounted displays. Head-mounted displays can be virtual reality (VR) devices, augmented reality (AR) devices, and smart glasses. Server 104 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.
[0048] In one exemplary embodiment, such as Figure 2 As shown, a data query method is provided, which can be applied to... Figure 1 Taking server 104 as an example, the explanation includes the following steps 202 to 206. Wherein:
[0049] Step 202: Receive query request.
[0050] The query request includes at least one query attribute. For example, a query attribute may include the account's classification attribute, organizational scope, usage status, business type, or other attribute information related to data filtering. The query request may also include specific restrictions corresponding to the query attribute; for example, the restriction for the classification attribute could be a detailed account, a cash account, or an intercompany account.
[0051] In some embodiments, a query request may be a query instruction based on SQL (Structured Query Language), or a JSON or XML payload encapsulated in the HTTP request body, or a query instruction based on DSL (Domain-Specific Language).
[0052] Step 204: Match each query attribute with the memory attributes in memory to obtain the matching memory attributes, and use the bitmap data corresponding to the matching memory attributes to obtain the target subject identifier.
[0053] Bitmap data refers to data that is mapped and compressed from basic information of multiple attributes in the database and stored in memory as bitmaps under each attribute. The target account identifier is a unique identifier for the account in the system, which can directly correspond to the primary key or index field in the database.
[0054] In this embodiment, each basic data in the database has a unique correspondence with bitmap data in memory. In memory, each memory attribute corresponds to at least one bitmap, and each bit in the bitmap is used to indicate the presence or absence of the corresponding subject identifier.
[0055] For example, taking accounting subjects as an example, such as Figure 3 As shown, one memory attribute in memory is the organization's right to use a subject. The memory attribute can include multiple bitmaps corresponding to organizations. In the bitmap of organization 1, bitmap data 1 indicates that organization 1 has the right to use the subject corresponding to the bit, and bitmap data 0 in organization 1 indicates that organization 1 does not have the right to use the subject corresponding to the bit. In the bitmap of organization 2, bitmap data 1 indicates that organization 2 has the right to use the subject corresponding to the bit, and bitmap data 0 in organization 2 indicates that organization 2 does not have the right to use the subject corresponding to the bit.
[0056] For example, such as Figure 4 As shown, a tree structure recording memory attributes is stored in memory. Based on the tree structure and bitmap, the hierarchical relationship between each memory attribute can be easily calculated. For the matching memory attribute and query attribute "subject code", the query request can impose the following specific restrictions on this query attribute, including but not limited to: subject code 1001.02 includes all its subordinate subjects; subject code 1001.02; all parent subjects of subject code 1001.02; subject code 1001.02 does not include its direct subordinate subjects. For the bitmap of the memory attribute subject code 1001.02, bitmap data 0 indicates that the subject code of the corresponding subject identifier is not 1001.02; bitmap data 1 indicates that the subject code of the corresponding subject identifier is 1001.02.
[0057] For example, each piece of basic data in the database includes a primary key, which is a long integer, occupying 8 bytes. After mapping and compressing the basic data, the bitmap data stored in memory can be represented by a 4-byte integer, with a range up to 2,147,483,647; for basic data with a clearly small amount of data, the bitmap data in memory can be represented by a 2-byte Short type.
[0058] In this step, the basic data of each attribute in the database is mapped and compressed and then stored in memory as discrete bitmap data. This allows for efficient compression and storage of large amounts of basic data, with a compression ratio of up to 99.9%, thereby effectively reducing memory resource consumption. It also facilitates the transformation of multi-level repetitive query processes into efficient and simple bit operations during data queries, quickly obtaining the target subject identifier that matches the query attribute, which helps to achieve fast memory-level queries.
[0059] Step 206: Based on the target subject identifier, determine the target query data corresponding to the query request from the database.
[0060] Specifically, a targeted data query request can be sent to the database based on the target subject identifier, enabling the database to quickly locate the data corresponding to the target subject identifier as the target query data, and then return the target query data to the client to complete the data query process.
[0061] In some embodiments, memory and database are connected via a mirrored query interface to ensure real-time data querying, which is suitable for various real-time and non-real-time business scenarios.
[0062] In the aforementioned data query method, the basic data stored in the database is mapped and compressed, and then stored in memory as bitmap data. This enables efficient compression of the basic data, effectively reducing memory usage. When responding to a query request, the target subject identifier can be quickly determined from the bitmap data stored in memory, and then the target query data can be obtained from the database. In this way, by transforming the traditional filtering process of a large number of subjects in the database into efficient bit operations, fast, efficient, and low-latency data queries can be achieved in memory in business scenarios with large data volumes, multi-dimensional query conditions, and frequent changes. This effectively reduces query complexity, speeds up queries, and improves data query efficiency.
[0063] In one exemplary embodiment, based on Figure 2 The illustrated embodiments, such as Figure 5 As shown, using the bitmap data corresponding to the matched memory attributes, the target subject identifier is obtained, including:
[0064] Step 502: Perform memory bitmap calculation on the bitmap data corresponding to the matched memory attributes to obtain multiple target bitmap indices.
[0065] In this context, memory bitmap computation refers to performing logical operations on the bitmap data corresponding to each memory attribute that matches the query attribute, to obtain the target bitmap index that conforms to each query attribute. Logical operations can involve performing logical AND and logical OR operations based on the specific constraints corresponding to the query attribute, filtering out the bitmap indexes that conform to each query attribute as the target bitmap index.
[0066] For example, see [link to relevant documentation]. Figure 4 ,exist Figure 4From the perspective of the bitmap, the first bitmap data from the right corresponds to the subject identifier ID1, the second bitmap data from the right corresponds to the subject identifier ID2, and so on. When querying "subject with subject code 1001.02", according to the bitmap with subject code 1001.02, the third bitmap data from the right is 1, indicating that it matches the query, and its corresponding bitmap index "3" is the target bitmap index.
[0067] In some embodiments, the query request involves query attributes and specific restrictions on the organizational scope. Bitmaps that meet the organizational scope restrictions can be obtained first, and then the intersection of these bitmaps with other attribute bitmaps can be calculated to achieve fast filtering under the organizational dimension.
[0068] This step enables in-memory data filtering in complex query scenarios with multiple attributes and conditions, significantly reducing the number of data rows and computational loads involved in the database. The introduction of the bitmap data structure allows attribute filtering to complete matching judgments simply by performing efficient bitwise operations, significantly improving the execution speed of data filtering.
[0069] Step 504: Based on the preset mapping relationship between bitmap indexes and subject identifiers, perform memory mapping processing on multiple target bitmap indexes to obtain target subject identifiers.
[0070] The mapping relationship between bitmap index and account identifier can be pre-stored in the form of bitmap index file. The bitmap index file can be directly mapped to the virtual memory address space or stored on the local disk to ensure high-speed access during query.
[0071] In one possible implementation, all query attributes in the query request are matched with memory attributes. After obtaining the target subject identifier, the target query data corresponding to the query request is determined from the database based on the target subject identifier, and the data query process ends.
[0072] In one possible implementation, some query attributes in the query request match the memory attribute, while some query attributes do not match the memory attribute. Based on the target subject identifier, the target query data corresponding to the query request is determined from the database, including: performing preliminary screening of the database using the target subject identifier to obtain candidate query information; and using at least one query attribute that does not match the memory attribute to determine the target query data corresponding to the query request from the candidate query information.
[0073] Among them, for some less frequently used attributes whose result sets are controllable after being filtered through memory, it is more suitable to store them in a database, as they cannot be matched in memory.
[0074] In some embodiments, the process of obtaining candidate query information includes: updating the query instruction using the target subject identifier to obtain a database query instruction; and querying the database using the database query instruction to obtain candidate query information. The database query instruction includes the target subject identifier and query attributes that failed to match.
[0075] In this implementation, when there are query attributes that do not match the memory attributes, the target subject identifier is first determined from memory using the matching query attributes. During the data query process from the database, the target subject identifier is first used to perform a preliminary screening in the database to determine candidate query information. Then, the query attributes that did not match are used to perform a second query from the database to obtain the target query data. In this way, by using a layered filtering method between memory and database, the accuracy of the query results is ensured while optimizing the overall query efficiency.
[0076] In this embodiment, the target subject identifier can be efficiently filtered out by performing simple logical calculations on the bitmap data in memory. After obtaining the target subject identifier, a precise query can be initiated directly on the database based on the target subject identifier to quickly obtain the target query data, thereby greatly improving the data query efficiency.
[0077] In an exemplary embodiment, before matching each query attribute with memory attributes in memory to obtain the matching memory attributes, the method further includes: obtaining a memory view corresponding to the memory; performing an inspection process on the memory view based on the query request to obtain a memory view inspection result; and using memory as a data source if the memory view inspection result is ready.
[0078] The memory view check process refers to detecting whether a ready memory view exists in the system memory. If a ready memory view exists, it means that information that can respond to the query request is stored in memory. Memory can then be used as a data source to continue the process of filtering and selecting the bitmap data stored in memory using query attributes to obtain the target subject identifier. Based on the target subject identifier, the process of determining the target query data corresponding to the query request from the database is then performed.
[0079] For example, a memory view can be a view status table in memory. The memory view check result can be obtained by looking up and verifying the memory view identifier, version number, memory view status, update completion time, mapping address, or index file path.
[0080] In one possible implementation, the memory view includes a memory version number and multiple memory attributes. The process of checking the memory view based on a query request to obtain the memory view check result may further include: searching for each query attribute among the multiple memory attributes to obtain attribute lookup results; if the attribute lookup result is successful, retrieving the database version number from the database; performing a consistency comparison between the database version number and the memory version number to obtain a comparison result; if the comparison result is consistent, determining the memory view check result as ready.
[0081] In this process, if at least one query attribute is found among multiple memory attributes, the attribute lookup result is considered successful. A successful attribute lookup indicates that the information corresponding to the query attribute is stored in memory. The memory version number is then compared to the latest database version number. If they match, the memory view is the latest version, and memory can be used as a data source to determine the target subject identifier. If they do not match, the memory view is outdated, and memory cannot be used as a data source. A database query process needs to be initiated to determine the target query data corresponding to the query request from the database to ensure the correctness and timeliness of the target query data.
[0082] In one possible implementation, the method further includes: if the memory view check result is not ready, using the database as the data source; and filtering the basic information in the database based on each query attribute to obtain the target query data.
[0083] Among the scenarios where the memory view check result is not ready, there are two types: First, the attribute lookup result is "lookup failed," meaning the requested information is not in memory. Second, the attribute lookup result is "lookup successful," but the comparison result is "inconsistent," meaning the information corresponding to the queried attribute is stored in memory, but the stored information is outdated. In this case, the database needs to be used as the data source, and the target query data needs to be obtained directly from the database using the query attribute.
[0084] In one possible implementation, if the memory view check result is not ready, the basic data in the database is filtered based on each query attribute to obtain the target query data. The method further includes: performing mapping and compression processing on the target query data to obtain bitmap data corresponding to the target query data; and updating the bitmap data stored in memory using the bitmap data corresponding to the target query data to obtain updated bitmap data.
[0085] In some embodiments, after obtaining the bitmap data corresponding to the target query data, the method further includes updating the bitmap index file to obtain an updated bitmap index file; and updating the memory view to obtain an updated memory view.
[0086] In some embodiments, if the memory view check result is not ready, the process of updating the memory view is triggered asynchronously. That is, the query interface is not blocked during the process of updating the memory view. After the memory view is updated, it is loaded into memory asynchronously so that it can be used in subsequent query processes.
[0087] It is understandable that when data in the database is updated, such as through additions, modifications, or deletions, the database version number is updated accordingly, and the memory view check result for subsequent query commands will inevitably be "not ready." The method in this embodiment may further include: when data in the database is updated, performing mapping and compression processing on the updated data to obtain bitmap data corresponding to the target query data system; and updating the bitmap data stored in memory using the bitmap data corresponding to the target query data system to obtain updated bitmap data.
[0088] In this embodiment, the attribute lookup and version number comparison mechanism ensures that the target subject identifier can be obtained during data query, and that the obtained target subject identifier is consistent with the latest version in the database. This avoids errors in query results or data lag caused by finding older versions of data, thus improving the real-time performance and reliability of the data query method. Furthermore, if the comparison results are consistent, the bitmap data stored in memory is directly filtered, avoiding the need to rebuild the memory view for each query, thereby reducing the number of repeated reconstructions and improving query efficiency.
[0089] In one exemplary embodiment, such as Figure 6 As shown, a data query method is provided, which can be applied to... Figure 1 Taking server 104 as an example, the explanation includes the following steps 601 to 614. Wherein:
[0090] Step 601: Receive query request.
[0091] The query request includes at least one query attribute.
[0092] Step 602: Obtain the memory view corresponding to the memory.
[0093] The memory view includes the memory version number and multiple memory attributes.
[0094] Step 603: Based on the query request, perform an inspection on the memory view to obtain the memory view inspection result.
[0095] Specifically, the process involves searching for each of the specified memory attributes to obtain attribute search results; if the attribute search result is successful, retrieving the database version number from the database; performing a consistency comparison between the database version number and the memory version number to obtain a comparison result; and if the comparison result is consistent, determining the memory view check result as ready.
[0096] Step 604: Determine whether the memory view check result is ready.
[0097] Step 605: If the memory view check result is ready, match each query attribute with the memory attributes in memory to obtain the matching memory attributes.
[0098] Step 606: Perform memory bitmap calculation on the bitmap data corresponding to the matched memory attributes to obtain multiple target bitmap indices.
[0099] Bitmap data is data that is stored in memory as bitmaps under each attribute after mapping and compressing the basic information of multiple attributes in the database.
[0100] Step 607: Based on the preset mapping relationship between bitmap indexes and subject identifiers, perform memory mapping processing on multiple target bitmap indexes to obtain target subject identifiers.
[0101] Step 608: If all query attributes match memory attributes, determine the target query data corresponding to the query request from the database based on the target subject identifier.
[0102] Step 609: In cases where a query attribute does not match a memory attribute, the database is initially filtered using the target subject identifier to obtain candidate query information.
[0103] Step 610: Using at least one query attribute that does not match the memory attribute, determine the target query data corresponding to the query request from the candidate query information.
[0104] Step 611: If the memory view check result is not ready, use the database as the data source.
[0105] Step 612: Based on each query attribute, filter the basic data in the database to obtain the target query data.
[0106] Step 613: Perform mapping and compression processing on the target query data to obtain the bitmap data corresponding to the target query data.
[0107] Step 614: Update the bitmap data stored in memory using the bitmap data corresponding to the target query data to obtain the updated bitmap data.
[0108] In this embodiment, the basic data stored in the database is mapped and compressed, and then stored in memory as bitmap data. This supports the memory storage of 50 million subject records, occupying 35MB of memory space. This achieves efficient compression of the basic data, effectively reducing memory usage. When responding to a query request, the target subject identifier can be quickly determined from the bitmap data stored in memory, and then the target query data can be obtained from the database. In this way, by transforming the filtering process of a large number of subjects in the database in traditional technology into efficient bit operations, fast, efficient, and low-latency data queries can be achieved in memory in business scenarios with large data volumes, multi-dimensional query conditions, and frequent changes. This effectively reduces query complexity, speeds up queries, and improves data query efficiency.
[0109] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.
[0110] Based on the same inventive concept, this application also provides a data query apparatus for implementing the data query method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more data query apparatus embodiments provided below can be found in the limitations of the data query method described above, and will not be repeated here.
[0111] In one exemplary embodiment, such as Figure 7 As shown, a data query device is provided, including: a request receiving module 702, an identifier filtering module 704, and an information query module 706, wherein:
[0112] The request receiving module 702 is used to receive query requests, which include at least one query attribute.
[0113] The identifier filtering module 704 is used to match each query attribute with the memory attributes in memory to obtain the matching memory attributes, and use the bitmap data corresponding to the matching memory attributes to obtain the target subject identifier. The bitmap data is the data that is stored in the memory attributes in the form of bitmap after mapping and compressing the basic information of multiple attributes in the database.
[0114] The information query module 706 is used to determine the target query data corresponding to the query request from the database based on the target subject identifier.
[0115] In one embodiment, the identifier filtering module 704 is used to perform memory bitmap calculation on the bitmap data corresponding to the matched memory attributes to obtain multiple target bitmap indices; based on the preset mapping relationship between bitmap indices and subject identifiers, memory mapping processing is performed on the multiple target bitmap indices to obtain target subject identifiers.
[0116] In one embodiment, the information query module 706 is further configured to perform preliminary screening of the database using the target subject identifier to obtain candidate query information; and to determine the target query data corresponding to the query request from the candidate query information using at least one query attribute that does not match the memory attribute.
[0117] In one embodiment, the device further includes a view inspection module for obtaining a memory view corresponding to the memory; performing inspection processing on the memory view based on a query request to obtain a memory view inspection result; and using the memory as a data source if the memory view inspection result is ready.
[0118] In one embodiment, the memory view includes a memory version number and multiple memory attributes. The view inspection module is also used to search for each query attribute among the multiple memory attributes to obtain attribute search results; if the attribute search result is successful, the database version number is obtained from the database; the database version number and the memory version number are compared for consistency to obtain a comparison result; if the comparison result is consistent, the memory view inspection result is determined to be ready.
[0119] In one embodiment, the view inspection module is further configured to use the database as the data source if the memory view inspection result is not ready; the information query module 706 is further configured to filter the basic information in the database based on each query attribute to obtain the target query data.
[0120] In one embodiment, the device further includes: a data update module, configured to perform mapping and compression processing on the target query data to obtain bitmap data corresponding to the target query data; and update the bitmap data stored in memory using the bitmap data corresponding to the target query data to obtain updated bitmap data.
[0121] Each module in the aforementioned data query device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0122] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 8 As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores bitmap data corresponding to memory attributes. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external clients via a network connection. When executed by the processor, the computer program implements a data query method.
[0123] Those skilled in the art will understand that Figure 8 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0124] In one exemplary embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.
[0125] In one exemplary embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above-described method embodiments.
[0126] In one exemplary embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.
[0127] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0128] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, database, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0129] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0130] The above embodiments are merely illustrative of several implementation methods of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A data query method, characterized in that, The method includes: Receive a query request, the query request including at least one query attribute; The query attributes are matched with the memory attributes in memory to obtain the matched memory attributes. The target subject identifier is obtained by using the bitmap data corresponding to the matched memory attributes. The bitmap data is data that is stored in the form of a bitmap under each memory attribute after mapping and compressing the basic data of multiple attributes in the database. Based on the target subject identifier, the target query data corresponding to the query request is determined from the database.
2. The method according to claim 1, characterized in that, The step of obtaining the target subject identifier using the bitmap data corresponding to the matched memory attributes includes: Memory bitmap calculations are performed on the bitmap data corresponding to the matched memory attributes to obtain multiple target bitmap indices; Based on the preset mapping relationship between bitmap indexes and subject identifiers, memory mapping processing is performed on multiple target bitmap indexes to obtain the target subject identifier.
3. The method according to claim 2, characterized in that, The step of determining the target query data corresponding to the query request from the database based on the target subject identifier includes: The database is initially filtered using the target subject identifier to obtain candidate query information; Using other query attributes among the at least one query attribute that do not match the memory attribute, the target query data corresponding to the query request is determined from the candidate query information.
4. The method according to claim 1, characterized in that, Before matching each of the query attributes with memory attributes in memory to obtain the matching memory attributes, the method further includes: Obtain the memory view corresponding to the memory; Based on the query request, the memory view is inspected to obtain the memory view inspection result; If the memory view check result is "ready", then memory is used as the data source.
5. The method according to claim 4, characterized in that, The memory view includes a memory version number and multiple memory attributes. The process of checking the memory view based on the query request to obtain the memory view check result includes: Search for each of the query attributes among the multiple memory attributes to obtain the attribute search results; If the attribute lookup result is successful, the database version number is retrieved from the database; A consistency comparison is performed between the database version number and the memory version number to obtain the comparison result; If the comparison results are consistent, the memory view check result is determined to be ready.
6. The method according to claim 4, characterized in that, The method further includes: If the memory view check result is not ready, the database will be used as the data source; Based on the query attributes, the basic data in the database is filtered to obtain the target query data.
7. The method according to claim 6, characterized in that, The method further includes: The target query data is mapped and compressed to obtain bitmap data corresponding to the target query data. The bitmap data stored in memory is updated using the bitmap data corresponding to the target query data to obtain the updated bitmap data.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.