Data query method and device, computer equipment and computer readable medium

By aggregating cache blocks of business objects in the memory cache and directly accessing the target data records, the problem of low efficiency in multi-table join queries in traditional relational databases is solved, achieving high-efficiency data query and response speed.

CN121542298APending Publication Date: 2026-02-17SHENZHEN INST OF COMPUTING SCI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511408709.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-29
Publication Date
2026-02-17

AI Technical Summary

Technical Problem

Traditional relational databases are inefficient when performing multi-table joins, resulting in slow query response times and wasted memory resources.

Method used

By aggregating cache blocks of business objects in the memory cache, the target data records can be accessed directly, reducing cross-table join operations and improving query efficiency.

Benefits of technology

It significantly improves the efficiency and response speed of data queries, reduces access to the underlying database, and improves memory resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121542298A_ABST
    Figure CN121542298A_ABST
Patent Text Reader

Abstract

The invention is suitable for the technical field of databases, and relates to a data query method and device, computer equipment and a computer readable medium. The data query method comprises the following steps: receiving an input data query statement, and determining query semantics of the data query statement; determining a target business object associated with the query semantics in the predefined business objects; a first target cache block of a target business object is determined from cache blocks of different business objects cached in a memory, and data records of the business objects which the cache blocks belong to in different relation tables are aggregated in the cache blocks; and querying the target data record matched with the query semantics from the first target cache block, and outputting the target data record. The data query efficiency can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of database technology, and in particular to a data query method, a data query device, a computer device, and a computer-readable storage medium. Background Technology

[0002] In the wave of digital transformation, enterprises face the challenge of massive amounts of data, especially in relational data processing, where traditional structured storage methods are gradually showing their limitations. Relational databases, with their standardized tabular format, have solved many problems related to data storage and management. However, in actual business data access, complex query operations are often required in relational databases, and these queries often involve high-consumption operations such as multi-table joins and aggregation calculations, resulting in low query efficiency. Summary of the Invention

[0003] This application provides a data query method, a data query device, a computer device, and a computer-readable storage medium, which can effectively improve data query efficiency.

[0004] In a first aspect, embodiments of this application provide a data query method, including: Receive the input data query statement and determine the query semantics of the data query statement; Identify the target business objects in the predefined business objects that are associated with the query semantics; From the cache blocks of different business objects in the memory cache, determine the first target cache block of the target business object. The cache block aggregates the data records of the business object to which it belongs in different relational tables. Retrieve the target data record that matches the query semantics from the first target cache block and output the target data record.

[0005] Secondly, embodiments of this application provide a data query device, comprising: The statement processing module is used to receive input data query statements and determine the query semantics of the data query statements; The object determination module is used to determine the target business object that is associated with the query semantics among the predefined business objects; The cache query module is used to determine the first target cache block of the target business object from the cache blocks of different business objects in the memory cache. The cache block aggregates the data records of the business object to which it belongs in different relational tables. The data query module is used to query the target data records that match the query semantics from the first target cache block and output the target data records.

[0006] Optionally, in one embodiment, the object determination module is further configured to determine other business objects that are associated with the target business object if the determination of the first target cache block fails; The cache query module is also used to determine the cache blocks of other business objects from the cache blocks of different business objects in the memory cache; The data query module is also used to query target data records that match the query semantics from the cache blocks of other business objects and output the target data records.

[0007] Optionally, in one embodiment, the data query apparatus provided by the present invention further includes a table determination module, used to determine the target relation table indicated by the data query statement if determining the cache block of other business objects fails; The data query module retrieves target data records from the target relation table that match the query semantics and outputs the target data records.

[0008] Optionally, in one embodiment, the data query device provided by the present invention further includes a first object definition module, used to receive input object definition information and define business objects according to the object definition information.

[0009] Optionally, in one embodiment, the data query device provided by the present invention further includes a second object definition module, which is used to define a business object according to the associated field if the associated query request for the same associated field meets the object definition conditions.

[0010] Optionally, in one embodiment, the data query apparatus provided by the present invention further includes a data update module, configured to receive an input data change request, determine the second target cache block involved in the data record to be changed in the data change request; execute the data change request, and update the second target cache block according to the changed data record.

[0011] Optionally, in one embodiment, the data update module is further configured to assess the impact of the data change request; if the impact is less than a threshold, the second target cache block is incrementally updated based on the changed data record; otherwise, the second target cache block is fully updated based on the changed data record.

[0012] Thirdly, the computer device provided in the embodiments of this application includes a processor and a memory. The memory stores a computer program that can run on the processor. When the processor runs the computer program, it implements the data query method provided in the embodiments of this application.

[0013] Fourthly, the computer-readable storage medium provided in the embodiments of this application stores a computer program, which, when executed by a processor, implements the data query method provided in the embodiments of this application.

[0014] The data query scheme provided in this application receives an input data query statement and determines its query semantics; identifies a target business object associated with the query semantics among predefined business objects; determines a first target cache block for the target business object from cache blocks of different business objects cached in memory, where each cache block aggregates data records of its respective business object in different relational tables; queries the first target cache block to retrieve the target data record matching the query semantics, and outputs the target data record. In this way, by aggregating and caching data records from multiple relational tables according to business objects, the aggregated cache block can be directly accessed when executing a data query statement, eliminating the need for complex join operations on multiple relational tables, thereby significantly improving the efficiency and response speed of data queries. Attached Figure Description

[0015] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0016] Figure 1 This is a schematic diagram of an application environment for the data query method provided in the embodiments of this application; Figure 2 This is a flowchart illustrating the data query method provided in an embodiment of this application; Figure 3 This is an example diagram of an aggregated cache block in an embodiment of this application; Figure 4 This is another example diagram of the aggregated cache block in the embodiments of this application; Figure 5 This is a schematic diagram of the structure of the data query device provided in the embodiments of this application; Figure 6 This is a schematic diagram of the structure of the computer device provided in the embodiments of this application. Detailed Implementation

[0017] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.

[0018] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.

[0019] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0020] As used in this application specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if detected [the described condition or event]" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once detected [the described condition or event]," or "in response to detection [the described condition or event]."

[0021] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0022] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0023] It should be understood that the sequence number of each step in the following embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0024] In related technologies, to improve the query efficiency of relational databases, memory caching technology is used to store frequently accessed data in memory, reducing disk read operations and significantly improving query response speed. However, traditional memory caching technology typically uses data blocks of relational tables as units, with a one-to-one correspondence between the data and the data stored on disk. When performing join queries between multiple relational tables, a large number of data blocks need to be accessed and cached, resulting in many unnecessary data block scans. For example, if a relational database has two tables, "User" and "Order," and a join query is used to retrieve a user's information and their order information, it is necessary to access the data blocks of the user table and the order table cached in memory, respectively. Each data block includes not only the user being queried but also the user information and order information of other users. This means that although it is a query for a single user's data, the actual amount of data scanned can be magnified several times or even more, resulting in wasted memory resources and decreased query efficiency.

[0025] To effectively improve the efficiency of multi-table join queries, this invention provides a data query method, a data query device, a computer device, and a computer-readable storage medium based on memory caching. The data query method can be executed by the data query device or by a computer device integrating the data query device.

[0026] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described below are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0027] Please refer to Figure 1 , Figure 1 This is a schematic diagram illustrating an application environment for the data query method provided in this application. As one implementation, the data query method provided in this application can be applied to a server 100, which is connected to a terminal device 200 via a network. The server 100 provides database services to the terminal device 200. The network, used as a medium to provide a communication link between the server 100 and the terminal device 200, can include various connection types, such as wired communication links, wireless communication links, etc., and this application embodiment does not limit this.

[0028] It should be noted that, Figure 1The server 100, network, and terminal device 200 shown are merely illustrative. Depending on actual needs, there can be any number of servers 100. For example, the server 100 can be implemented by a standalone physical server, a server cluster consisting of multiple servers, or a distributed system, etc., and the terminal device 200 can be any device such as a mobile phone, tablet, desktop computer, or laptop.

[0029] In some embodiments, server 100 can receive data query statements generated and input by user query operations from terminal device 200, and determine the query semantics of the data query statements; determine the target business object associated with the query semantics among predefined business objects; determine a first target cache block of the target business object from cache blocks of different business objects cached in memory, wherein the cache block aggregates data records of its respective business object in different relational tables; query the target data record matching the query semantics from the first target cache block, output the target data record, and finally return the target data record to terminal device 200 to complete the data query operation. In practical applications, this data query method can be widely used in various big data scenarios, such as financial risk control, intelligent recommendation, real-time monitoring, etc., providing efficient and reliable technical support for complex business queries.

[0030] Please refer to Figure 2 , Figure 2 This is a flowchart illustrating a data query method provided in an embodiment of this application, such as... Figure 2 As shown, the flow of this data query method can be as follows: In S110, the input data query statement is received, and the query semantics of the data query statement are determined.

[0031] The following explanation uses the server as the execution entity for the data query method. The database deployed on the server is used to maintain various business-related data in the business system, which can be an academic affairs management system, a commodity trading system, a medical information management system, and so on. For example, business-related data in the academic affairs management system may include student basic information, course information, and grade records; similarly, business-related data in the commodity trading system may include product information, order information, and user reviews.

[0032] Data query statements can be based on natural language or structured data query statements. They are trigger commands used to query data records in a database that contain business data.

[0033] Query semantics refers to the specific intent, data requirements, and related logic expressed by a data query statement from a business perspective. Simply put, it's about what business data the query statement wants to obtain; it focuses on the business purpose of the query, rather than the specific syntax or implementation method. For example, taking structured data query statements as an example, query statement 1 "SELECT student_table.name, course_table.course_name FROM student_table JOIN course_table ON student_table.student_id=course_table.student_id WHERE student_table.student_id='A'" and query statement 2 "SELECT course_table.course_name FROM course_table WHERE student_id='A'" have different syntax, but their query semantics are the same—"get the course names selected by the student with student_id A," revolving around the business intent of "student course selection information." Similarly, taking natural language data query statements as an example, "query Zhang San's shopping orders" and "see what Zhang San bought" have different expressions, but the underlying query semantics are both to obtain user Zhang San's historical shopping information. Therefore, the core of understanding query semantics lies in parsing the business requirements behind data query statements, rather than being bound by specific query syntax or expressions.

[0034] In this embodiment, after receiving a data query statement, the server first performs semantic analysis to determine the query semantics, i.e., the query intent. The specific implementation method of semantic analysis is not limited here; it can be implemented using natural language processing techniques, machine learning models, or rule engines. For example, if the data query statement is in natural language form, natural language processing techniques can be used to perform lexical analysis, syntactic analysis, and semantic role labeling to identify entities (such as "Zhang San" or "shopping order"), relationships (such as "query" or "view"), and business intent (such as obtaining historical shopping information). If the data query statement is a structured query statement, its syntax structure can be parsed to extract the relevant fields, table names, and query conditions, which are then mapped to business logic to determine the query semantics. The query semantics obtained through parsing will serve as the basis for the next step, providing a semantic-level basis for it.

[0035] In S120, the target business object associated with the query semantics in the predefined business objects is determined.

[0036] Business objects correspond to people, things, or abstract concepts in the real world, used to describe data subjects with clear business meanings, such as "student," "course," and "order." A business object corresponds to multiple relational tables in the database, which record various information related to that business object. For example, taking an academic affairs management system as an example, if "student" is defined as a business object, then the student table (storing basic student information such as name and student ID) and the grade table (storing student exam scores), among other relational tables in the database, together constitute the data carrier of the "student" business object. These relational tables establish relationships through aggregated fields (such as the student ID field) corresponding to the business object "student." As another example, "student course selection status" is an abstract description of the course selection relationship between "student" and "course," belonging to an abstract concept, and can also be defined as a business object. In this case, the student table and the course table (storing course selection records such as student ID and course name), among other relational tables in the database, together constitute the data carrier of the "student course selection status" business object. These relational tables establish relationships through aggregated fields (such as student ID) corresponding to the business object "student course selection status."

[0037] It should be noted that business objects are logical concepts and do not depend on specific physical storage structures. The storage method (e.g., row-oriented, column-oriented) or normalization level (e.g., 1NF, 3NF) of the relational table does not affect the definition of a business object. The core of defining a business object lies in the business meaning it carries, not in its physical implementation details. In practical applications, the design of business objects must fully consider the completeness and consistency of business requirements, ensuring that they accurately reflect the key data subjects in the business process. Furthermore, business objects can be linked through association, aggregation, or inheritance to build more complex business models to support diverse query and analysis needs. For example, the "order" business object can be associated with business objects such as "customer" and "product" to achieve comprehensive analysis of customer purchasing behavior.

[0038] In this embodiment of the invention, after determining the query semantics of the input data query statement, the server further identifies business objects associated with the query semantics from predefined business objects, and denotes them as target business objects. For example, the server can obtain the semantic similarity between the query semantics and different predefined business objects, and determine the business objects with semantic similarity higher than a preset threshold as target business objects, or determine the business object with the highest semantic similarity as the target business object, and so on.

[0039] For example, taking the academic affairs management system as an example, assuming there are predefined business objects such as "student", "course", and "student course selection status", if the query semantics is "get the course names selected by student with student ID A", then "student course selection status" will be identified as the target business object by the server because it has the highest semantic similarity to the query semantics.

[0040] In S130, the first target cache block of the target business object is determined from the cache blocks of different business objects in the memory cache. The cache block aggregates the data records of the business object to which it belongs in different relational tables.

[0041] In this embodiment of the invention, the server caches cache blocks of different business objects in its memory. Each cache block aggregates data records of its respective business object in different relational tables, and the same business object can correspond to multiple cache blocks. The design of the cache blocks aims to improve data query efficiency. By aggregating and storing multi-table data records related to a business object, the server does not need to repeatedly perform complex cross-table join operations on each query.

[0042] Based on the above cache block design, after the server determines the target business object associated with the query semantics of the input data query statement, it can quickly locate the cache block corresponding to the target business object, which is denoted as the first target cache block. The first target cache block is used as the direct source of data query, thereby greatly improving the query response speed.

[0043] For example, please refer to Figure 3 The database defines three relation tables: Relation Table A, Relation Table B, and Relation Table C. Each relation table physically consists of N rows of data records. Assuming two business objects are defined: Business Object 1 and Business Object 2, the data records in Relation Tables A, B, and C containing the aggregation fields of Business Object 1 will be aggregated into cache block 1 and cache block 2 for Business Object 1. Conversely, the data records in Relation Tables A, B, and C containing the aggregation fields of Business Object 2 will be aggregated into cache block 3 for Business Object 2. Without aggregation cache blocks, the server would need to perform cross-table join operations on all three relation tables every time a query is executed. However, with the cache block aggregation mechanism, the server only needs to locate the corresponding business object's cache block in the cache to directly retrieve the required data records, eliminating the need to repeatedly perform complex cross-table join operations.

[0044] In S140, the target data record matching the query semantics is queried from the first target cache block, and the target data record is output.

[0045] As shown above, the first target cache block will be used as the direct source of data query. Accordingly, the server filters and matches the data records in the first target cache block according to the query semantics in order to quickly obtain the target data record that matches the query intent and output the target data record as the query result.

[0046] For example, taking the academic affairs management system as an example, please refer to... Figure 4The database contains three tables: a student table (including name and student ID fields), a course selection table (including course name and student ID fields), and a course table (including course name and time fields, not shown in the diagram). Assuming "Student Course Selection Status" is defined as a business object, and the aggregation field of this business object is the student ID field, then data records related to the student ID field in the student and course selection tables will be aggregated into the cache block of this business object. Specifically, for student A, the server aggregates the data records with student ID A from both the student and course selection tables into the same cache block A. This process continues, generating cache blocks for students with different student IDs (not shown in the diagram). This series of cache blocks collectively constitutes the cache block for the "Student Course Selection Status" business object. When the query semantics are "Get the course names selected by student A," the server can directly locate the cache block for student A and filter out the course name field as the query result output.

[0047] It should be noted that the aggregated caching based on business objects does not change the data storage structure of the original relational table, but rather builds a logical cache layer on top of it. This means that the original relational table can continue to perform normal update, deletion, and addition operations, and the aggregated caching does not affect the efficiency of these operations. Furthermore, because the cache block aggregates specific data records from the original relational table, the same cache block can support queries with different semantics. For example, for the cache block of the business object "student course selection status," when only the name of the student with student ID A needs to be queried, the server can retrieve the data record containing the name of the student with student ID A from this cache block as the query result output, without needing to use the course selection information from this cache block.

[0048] Optionally, in one embodiment, after determining the first target cache block of the target business object from the cache blocks of different business objects in the memory cache, the method further includes: If the first target cache block fails, then identify other business objects that are related to the target business object; From the cache blocks of different business objects in the memory cache, determine the cache blocks of other business objects; The process involves querying the target data record that matches the query semantics from the cache block of other business objects and then proceeding to output the target data record.

[0049] In this embodiment of the invention, the server also maintains a cache dependency table in memory, which records the relationships between various business objects. If the server has not yet cached the target business object's cache block in memory, the server will fail to determine the first target cache block, meaning that the cache block of the target business object is not found in memory at this time. The server further determines other business objects that are related to the target business object according to the cache dependency table and attempts to query the required data from the cache blocks of these related business objects. Specifically, the server determines the cache blocks belonging to the determined other business objects from the cache blocks of different business objects cached in memory, and performs a relational query on these cache blocks according to the query semantics to retrieve the target data record that matches the query semantics, that is, the data record that conforms to its query intent.

[0050] For example, for the business object "student class time," its associated business objects include "student course selection" and "course schedule." If the query semantics are "get the class time of student with student ID A," the business object "student class time" will be identified as the target business object. If the target business object "student class time" is not found in the cache, the server can query from the cache blocks of the associated business objects such as "student course selection" and "course schedule." Specifically, the server can first query the cache block of "student course selection" to find the course name selected by student with student ID A, and then combine that course name to query the corresponding class time from the cache block of "course schedule," ultimately obtaining the class time of student with student ID A as the query result.

[0051] The cache block-based association query mechanism provided by this invention not only improves the flexibility of data query, but also enhances the fault tolerance capability in the case of cache miss, enabling the server to make the most of existing cache resources without sacrificing query efficiency, reduce direct access to the underlying database, and reduce the overall query response latency.

[0052] Optionally, in one embodiment, after determining the cache blocks of other business objects from the cache blocks of different business objects in the memory cache, the method further includes: If it is determined that the cache block of other business objects has failed, then determine the target relation table indicated by the data query statement; The process involves querying the target data record from the target relation table to match the query semantics, and then proceeding to the step of outputting the target data record.

[0053] Understandably, in practical applications, there may be situations where cache blocks of other business objects related to the target business object are also missed. In such cases, the server needs to fall back to the underlying database to query the data to ensure the integrity and accuracy of the data query.

[0054] In this embodiment of the invention, when the server determines that the cache blocks of other business objects associated with the target business object also fail, it further determines the relational table to be queried indicated by the data query statement, denoted as the target relational table. For example, for the natural language data query statement "Get student A's course selection information", the indicated target relational table includes the "student table" and the "course selection table"; as another example, for the structured data query statement "SELECT course table.course name FROM course table WHERE student ID = 'A'", the indicated target relational table also includes the "student table" and the "course selection table".

[0055] As described above, after identifying the target relation table, the server performs a join query on the identified target relation table to retrieve the target data records that match the query semantics as the query result output. Thus, the server achieves an efficient data query strategy through a query and rollback mechanism using the memory cache. On one hand, this mechanism utilizes the relationships between cache blocks to quickly assemble data when the cache is hit, improving query response speed; on the other hand, when the cache is missed, it backtracks to the underlying relation table for querying, ensuring data integrity and accuracy.

[0056] Optionally, in one embodiment, before receiving the input data query statement, the data method provided by the present invention further includes: Receive the input object definition information and define the business object based on the object definition information.

[0057] In this embodiment of the invention, database users can actively define business objects according to actual usage needs.

[0058] The server can receive input object definition information and define business objects based on the object definition information. There are no restrictions on the specific form of the object definition information. For example, it can be structured configuration information or definition semantics described in natural language.

[0059] For example, in pseudocode form, the object definition information of a business object can be: DEFINE BUSINESS OBJECT UserAgg ON KEY (UserID) This indicates the definition of a business object "UserAgg", with "UserID" as its aggregation field. Through this aggregation field, all data records including those with the "UserID" aggregation field can be bound to this business object, enabling data aggregation and management. Furthermore, after defining the business object "UserAgg", the server aggregates related data records in memory based on the "UserID" aggregation field, forming a cache block for the business object "UserAgg" to provide a fast access path for subsequent data queries.

[0060] Optionally, in one embodiment, before receiving the input data query statement, the data method provided by the present invention further includes: If a query request for the same related field meets the object definition conditions, then a business object is defined based on the related field.

[0061] In this embodiment of the invention, the definition of business objects can also be automatically triggered by the server.

[0062] A related field is a field used in a related query to connect two or more relational tables. It is usually a field with the same semantics, such as "Student ID" in the "Student Table" and "Student ID" in the "Course Selection Table".

[0063] The server performs statistical analysis on related query requests targeting the same associated field. When the statistical analysis shows that related query requests for a certain associated field meet preset object definition conditions, it automatically defines a business object based on that associated field. The specific configuration of the object definition conditions is not limited here; for example, it can be set to a threshold for the cumulative number of related query requests for the associated field, or a threshold for the frequency of related query requests for the associated field, and so on.

[0064] When defining a business object based on an associated field, the server can define the business object according to the semantics of the associated field and directly use the associated field as the aggregation field of the defined business object. For example, if the associated field is "Student ID", the defined business object can be named "StudentAgg", and the associated field "Student ID" can be used as the aggregation field of the business object "StudentAgg", ensuring that all data records associated with "Student ID" can be efficiently collected and managed. After completing the definition of the business object, the server builds a corresponding cache block in memory based on the aggregation field to accelerate subsequent data query operations.

[0065] Optionally, in one embodiment, the data query method provided by the present invention further includes: Receive the input data change request and determine the second target cache block involved in the data record for which the data change request is requested to be changed; Execute the data change request and update the second target cache block based on the changed data record.

[0066] As described above, this embodiment of the invention does not change the original data storage structure, but improves data query efficiency by building a cache block in memory. Therefore, it is possible to perform normal add, delete, and modify operations on data records in the original database.

[0067] In this embodiment of the invention, after receiving an input data change request, the server first parses the request to determine the data records involved, and then identifies a cache block containing these data records, denoted as the second target cache block. Subsequently, the server executes the data change request, modifying the corresponding data records in the database (which can be added, modified, or deleted), and updating the data records in the second target cache block accordingly to maintain consistency between the cache block and the data records in the database. This approach not only ensures the accuracy of data changes but also improves the efficiency and response speed of data queries without altering the existing storage structure. Furthermore, the update strategy for the aforementioned cache block can be flexibly configured according to actual business needs, employing real-time updates, delayed updates, or batch updates to achieve a balance between system performance and data consistency.

[0068] For example, when modifying the data record corresponding to a certain "student ID", the server will locate the cache block to which the "student ID" belongs and update the changed content to the cache block synchronously, ensuring that subsequent queries can still be executed based on the latest data status.

[0069] Optionally, in one embodiment, updating the second target cache block according to the changed data record includes: Assess the impact of the data change request; If the impact is less than the threshold, the second target cache block is incrementally updated based on the changed data records; otherwise, the second target cache block is fully updated based on the changed data records.

[0070] In this embodiment of the invention, different update methods are adopted when updating the second target cache block, depending on the impact of the data change request. The impact can be comprehensively assessed based on the amount of data record changes and the number of second target cache blocks involved; however, the specific assessment method for the impact is not limited here.

[0071] For example, assessing the impact of a data change request can be represented as follows: I = a * ΔD + b * ΔC; Where I represents the degree of impact, ΔD represents the amount of data record changes, ΔC represents the number of second target cache blocks involved, and a and b are preset weighting coefficients.

[0072] In this embodiment of the invention, after assessing the impact of the data change request, a corresponding update strategy is dynamically selected based on the magnitude of the impact. If the impact is less than a preset threshold, an incremental update is used to update the target cache block; if the impact is greater than or equal to the preset threshold, a full update is used to update the target cache block. Specifically, the incremental update synchronizes the changed data records to the corresponding second target cache block without altering other unchanged data records; the full update invalidates the original second target cache block and re-aggregates it based on the changed data records to obtain a new second target cache block.

[0073] Therefore, by reasonably assessing the impact of data changes, the most suitable update strategy can be dynamically selected, thereby effectively reducing system resource consumption while ensuring data consistency. Incremental updates are suitable for scenarios with small changes and limited impact, avoiding the high overhead of full updates; while full updates are suitable for larger changes involving multiple cache blocks, enabling more efficient cache reconstruction. By setting reasonable weight coefficients a and b, as well as impact thresholds, the adaptability and execution efficiency of the strategy can be further optimized. In practical applications, the weight coefficients a and b can be flexibly adjusted according to the actual business scenario. For example, in scenarios with frequent data changes but small individual change amounts, the weight of weight coefficient a can be appropriately increased, making the server more inclined to use incremental updates, thereby reducing overall resource consumption; while in scenarios with large-scale data changes involving multiple cache blocks, the weight of weight coefficient b can be appropriately increased to accelerate the response speed to large-scale changes. In addition, the threshold for the degree of impact should be dynamically adjusted in conjunction with the server load and business needs. For example, when the server load is low, the threshold can be lowered to improve the real-time performance of data updates, while when the load is high, the threshold can be appropriately increased to ensure the stability and performance balance of the server.

[0074] As described above, the data query scheme provided in this application receives an input data query statement and determines its query semantics; identifies the target business object associated with the query semantics among predefined business objects; determines a first target cache block for the target business object from cache blocks of different business objects cached in memory, where the cache block aggregates data records of its respective business object in different relational tables; queries the first target cache block to retrieve the target data record matching the query semantics, and outputs the target data record. Thus, by aggregating and caching data records from multiple relational tables according to business objects, the aggregated cache block can be directly accessed when executing a data query statement, eliminating the need for complex join operations on multiple relational tables, thereby significantly improving the efficiency and response speed of data queries.

[0075] To facilitate better implementation of the above data query methods, this application also provides a corresponding data query device. The meanings of the terms used are the same as in the above data query methods; for specific implementation details, please refer to the descriptions in the above method embodiments.

[0076] Please refer to Figure 5 , Figure 5 This is a schematic diagram of the structure of a data query device provided in an embodiment of this application. The data query device may include a statement processing module 210, an object determination module 220, a cache query module 230, and a data query module block 240, wherein... The statement processing module 210 is used to receive the input data query statement and determine the query semantics of the data query statement; The object determination module 220 is used to determine the target business object associated with the query semantics among the predefined business objects; The cache query module 230 is used to determine the first target cache block of the target business object from the cache blocks of different business objects in the memory cache. The cache block aggregates the data records of the business object to which it belongs in different relational tables. The data query module 240 is used to query the target data record that matches the query semantics from the first target cache block and output the target data record.

[0077] Optionally, in one embodiment, the object determination module 220 is further configured to determine other business objects that are associated with the target business object if the determination of the first target cache block fails; The cache query module 230 is also used to determine the cache blocks of other business objects from the cache blocks of different business objects in the memory cache; The data query module 240 is also used to query target data records that match the query semantics from the cache blocks of other business objects and output the target data records.

[0078] Optionally, in one embodiment, the data query apparatus provided by the present invention further includes a table determination module, used to determine the target relation table indicated by the data query statement if determining the cache block of other business objects fails; The data query module 240 queries the target data records that match the query semantics from the target relation table and outputs the target data records.

[0079] Optionally, in one embodiment, the data query device provided by the present invention further includes a first object definition module, used to receive input object definition information and define business objects according to the object definition information.

[0080] Optionally, in one embodiment, the data query device provided by the present invention further includes a second object definition module, which is used to define a business object according to the associated field if the associated query request for the same associated field meets the object definition conditions.

[0081] Optionally, in one embodiment, the data query apparatus provided by the present invention further includes a data update module, configured to receive an input data change request, determine the second target cache block involved in the data record to be changed in the data change request; execute the data change request, and update the second target cache block according to the changed data record.

[0082] Optionally, in one embodiment, the data update module is further configured to assess the impact of the data change request; if the impact is less than a threshold, the second target cache block is incrementally updated based on the changed data record; otherwise, the second target cache block is fully updated based on the changed data record.

[0083] It should be noted that the information interaction and execution process between the above modules are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, which will not be repeated here.

[0084] Figure 6 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Figure 6 As shown, the computer device includes: at least one processor ( Figure 6 The above-described data query method embodiments are implemented when the computer device is configured as a server, the processor executes the computer program, and only one of the components is shown in the diagram. The memory and the computer program stored in the memory and executable on at least one processor implement the steps in the above-described data query method embodiments.

[0085] This computer device may include, but is not limited to, a processor and memory. Those skilled in the art will understand that... Figure 6The examples of computer devices are merely examples and do not constitute a limitation on computer devices. Computer devices may include more or fewer components than shown in the illustration, or combinations of certain components, or different components, such as network interfaces, displays, and input devices.

[0086] The processor referred to can be a CPU, but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.

[0087] Memory includes readable storage media, internal memory, etc., wherein internal memory can be the RAM of a computer device, providing an environment for the operation of the operating system and computer-readable instructions stored in the readable storage media. The readable storage media can be the hard drive of a computer device, or in other embodiments, it can be an external storage device of the computer device, such as a plug-in hard drive, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card. Furthermore, memory can include both internal storage units and external storage devices of the computer device. Memory is used to store the operating system, applications, bootloader, data, and other programs, such as program code for computer programs. Memory can also be used to temporarily store data that has been output or will be output.

[0088] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above device can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here. If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the above method embodiments. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. A computer-readable medium can include at least: any entity or device capable of carrying computer program code, a recording medium, a computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.

[0089] The implementation of all or part of the processes in the methods of the above embodiments can also be accomplished by a computer program product. When the computer program product is run on a computer device, it enables the computer device to execute the steps in the above method embodiments.

[0090] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0091] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0092] In the embodiments provided in this application, it should be understood that the disclosed apparatus / computer devices and methods can be implemented in other ways. For example, the apparatus / computer device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0093] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0094] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. A data query method, characterized by, The method comprises: receiving an input data query statement and determining query semantics of the data query statement; determining a target business object associated with the query semantics in predefined business objects; determining a first target cache block of the target business object from cache blocks of different business objects cached in memory, the cache blocks aggregating data records of the business objects in different relation tables; querying target data records matching the query semantics from the first target cache block and outputting the target data records.

2. The data query method of claim 1, wherein, After the step of determining the first target cache block of the target business object from cache blocks of different business objects cached in memory, the method further comprises: if the determination of the first target cache block fails, determining other business objects having an association relationship with the target business object; determining a cache block of the other business object from cache blocks of different business objects cached in memory; querying target data records matching the query semantics from the cache block of the other business object and returning to the step of outputting the target data records.

3. The data query method of claim 2, wherein, After the step of determining the cache block of the other business object from cache blocks of different business objects cached in memory, the method further comprises: if the determination of the cache block of the other business object fails, determining a target relation table indicated by the data query statement; querying target data records matching the query semantics from the target relation table and returning to the step of outputting the target data records.

4. The data query method of any of claims 1-3, wherein, Before the step of receiving the input data query statement, the method further comprises: receiving input object definition information and defining business objects according to the object definition information.

5. The data query method of any of claims 1-3, wherein, Before the step of receiving the input data query statement, the method further comprises: if an association query request for the same association field meets an object definition condition, defining a business object according to the association field.

6. The data query method of any of claims 1-3, wherein, The method further comprises: receiving an input data change request and determining a second target cache block involved by a data record requested to be changed by the data change request; executing the data change request and updating the second target cache block according to the changed data record.

7. The data query method of claim 6, wherein, The step of updating the second target cache block according to the changed data record comprises: evaluating an influence degree of the data change request; if the influence degree is less than a degree threshold, performing incremental update of the second target cache block according to the changed data record, otherwise, performing full update of the second target cache block according to the changed data record.

8. A data query apparatus, characterized by comprising: The method comprises: a statement processing module configured to receive an input data query statement and determine query semantics of the data query statement; an object determining module configured to determine a target business object associated with the query semantics in predefined business objects; a cache querying module configured to determine a first target cache block of the target business object from cache blocks of different business objects cached in memory, the cache blocks aggregating data records of the business objects in different relation tables; a data querying module configured to query target data records matching the query semantics from the first target cache block and output the target data records.

9. A computer device, comprising: The computer device comprises a processor and a memory, and the memory stores a computer program capable of running on the processor, and the processor runs the computer program to implement the data query method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the data query method according to any one of claims 1 to 7.