Column data query method, device and equipment applied to database
By using timestamps and update time information from secondary tables in the database to determine the target data table, the problem of inconsistent data querying in mixed row and column tables is solved, ensuring the consistency and reliability of query results, meeting the real-time requirements of HTAP services, and improving concurrency throughput and TP performance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-31
- Publication Date
- 2026-04-10
AI Technical Summary
In databases with mixed row and column tables, the query results of column-stored data are inconsistent with the transaction data of row-stored data, which leads to a decrease in the accuracy and reliability of the query results. Moreover, existing methods are difficult to meet the real-time requirements of HTAP mixed services, increasing write and commit time and reducing concurrency throughput and TP performance.
By receiving data query requests and converting them into column data query requests, the target data table is determined using timestamp information and the latest update time information of the sub-table. This ensures that row-stored and column-stored data are read at the same time point, and a table update record incremental merging mechanism is adopted to guarantee the consistency of query results.
It enables the reading of data versions of both row-stored and column-stored data based on the same point in time within the same query, improving the accuracy and reliability of column-stored data query results, meeting the real-time requirements of HTAP hybrid services, and enhancing concurrency throughput and TP performance.
Smart Images

Figure CN121833802A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of database technology, and in particular to a method, apparatus, and device for querying column data in a database. Background Technology
[0002] Traditionally, TP (Transaction Provider) and AP (Application Processor) databases are separate. Real-time online transactions are conducted on the TP, and data is periodically unloaded from the TP database to a big data platform for big data analysis on the AP. This approach cannot support online real-time aggregation of massive amounts of data and report generation, and it increases the load on both the TP and AP platforms during large-scale data import and export processes.
[0003] Distributed HTAP databases support both row-based and column-based storage to meet the performance requirements of point-to-point and complex queries. Furthermore, through hybrid row-column tables, they satisfy both TP (transaction-oriented) and AP (analysis-oriented) scenarios. Hybrid row-column tables store the same records but with different storage formats. Therefore, near real-time data synchronization is performed between hybrid tables. During synchronization, column-based data has a certain latency relative to row-based data. Directly querying column-based data during this latency leads to query consistency issues. Due to the synchronization latency, column-based data may not yet include the latest committed transaction records in row-based data, resulting in inconsistent query results between row-based and column-based data at the same point in time. This manifests as understated statistical aggregations or reports, missing data, or reading outdated versions of data, thus affecting the accuracy of real-time analysis results and the reliability of business decisions.
[0004] Currently, in databases with mixed row-column tables, the main method for ensuring data consistency between row-store and column-store queries is to wait for both row-store and column-store transactions to commit before considering the update successful. This binds a TP transaction, which originally only required row-store commits, to column-store transactions as well. This makes it difficult to meet the real-time requirements of HTAP hybrid services, leading to increased write and commit times, reduced concurrency throughput, and weakened TP's guarantee of low latency and high performance. Summary of the Invention
[0005] This disclosure provides a column data query method, apparatus, and device for databases, enabling row storage and column storage to be read based on the same time version in the same query, ensuring that the column storage query results are consistent with the row storage transaction data, thereby improving the accuracy and reliability of the column storage data query results.
[0006] In a first aspect, embodiments of this disclosure provide a column data query method applied to a database, the method comprising:
[0007] Receive a data query request and convert the data query request into a column data query request; wherein the column data query request includes the first timestamp information of the data query request initiating the data query request;
[0008] Based on the first timestamp information in the column data query request and the latest update time information of at least one sub-table, determine at least one target data table to be accessed, wherein the at least one target data table includes at least one sub-table and / or a main table associated with the at least one sub-table;
[0009] If the at least one target data table includes a main table, the target column data corresponding to the column data query request is queried from the table update record table associated with the main table and the at least one target data table.
[0010] Secondly, embodiments of the present invention also provide a column data query device applied to a database, the device comprising:
[0011] A column data query request conversion module is used to receive a data query request and convert the data query request into a column data query request; wherein, the column data query request includes a first timestamp information of the data query request being initiated;
[0012] The target data table determination module is used to determine at least one target data table to be accessed based on the first timestamp information in the column data query request and the latest update time information of at least one sub-table, wherein the at least one target data table includes at least one sub-table and / or a main table associated with the at least one sub-table;
[0013] The target column data query module is used to query the target column data corresponding to the column data query request from the table update record table associated with the main table and the at least one target data table, when the at least one target data table includes a main table.
[0014] Thirdly, embodiments of the present invention also provide an electronic device, the electronic device comprising:
[0015] One or more processors;
[0016] Storage device for storing one or more programs.
[0017] When the one or more programs are executed by the one or more processors, the one or more processors implement the column data query method applied to the database as described in any embodiment of the present invention.
[0018] Fourthly, embodiments of the present invention also provide a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform a column data query method applied to a database as described in any of the embodiments of the present invention.
[0019] Fifthly, embodiments of the present invention also provide a computer program product, including a computer program, characterized in that, when executed by a processor, the computer program implements a column data query method applied to a database as described in any embodiment of the present invention.
[0020] The technical solution of this disclosure first receives a data query request and converts it into a column data query request. The column data query request includes a first timestamp information initiating the data query request. Then, based on the first timestamp information in the column data query request and the latest update time information of at least one sub-table, at least one target data table to be accessed is determined. This target data table includes at least one sub-table and / or a main table associated with at least one sub-table. Finally, if the target data table includes a main table, the target column data corresponding to the column data query request is queried from the table update record table associated with the main table and the at least one target data table. This solves the problems in the prior art where, when addressing the consistency of row-store and column-store data queries, each data update requires simultaneous waiting for both row-store and column-store transactions to be committed before the update is considered successful. These problems make it difficult to meet the real-time requirements of HTAP hybrid services, increase write and commit times, reduce concurrent throughput, and weaken the TP's guarantee of low latency and high performance. This embodiment of the disclosure implements querying the target column data corresponding to the column data query request based on the timestamp of the column data query request and the latest update time information of the sub-table. This enables the row storage and column storage to be read based on the same time version in the same query, ensuring that the column storage query results are consistent with the row storage transaction data, thereby improving the accuracy and reliability of the column storage data query results. Attached Figure Description
[0021] To more clearly illustrate the technical solutions of exemplary embodiments of the present invention, the accompanying drawings used in describing the embodiments are briefly introduced below. Obviously, the accompanying drawings described are only a portion of the drawings of the embodiments to be described in this invention, and not all of the drawings. For those skilled in the art, other drawings can be obtained from these drawings without any creative effort.
[0022] Figure 1 This is a flowchart illustrating a column data query method applied to a database, provided in an embodiment of this disclosure.
[0023] Figure 2 This is a flowchart illustrating a column data query method applied to a database, provided in an embodiment of this disclosure.
[0024] Figure 3 A schematic diagram of the structure of a column data query device applied to a database, provided in an embodiment of this disclosure;
[0025] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation
[0026] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, the accompanying drawings show only the parts relevant to the present invention, and not all of the structures.
[0027] Before introducing the technical solutions provided by the embodiments of this disclosure, the application scenarios can be illustrated first. The technical solutions provided by the embodiments of this disclosure can be applied to scenarios where column data in a database composed of row and column data tables is queried. Based on the technical solutions of the embodiments of this disclosure, the target column data corresponding to the column data query request is queried based on the timestamp of the column data query request and the latest update time information of the sub-table. This ensures that the row and column stores are read based on the same data version at the same point in time in the same query, ensuring that the column store query results are consistent with the row store transaction data, thereby improving the accuracy and reliability of the column store data query results.
[0028] Example 1
[0029] Figure 1 This is a flowchart illustrating a column data query method for a database provided in this embodiment. This embodiment is applicable to querying column data in a database composed of row and column data tables. The method can be executed by a column data query device for a database. This device can be implemented in the form of software and / or hardware. The hardware can be a mobile electronic device. The electronic device can execute the column data query method for a database provided in this technical solution.
[0030] like Figure 1 As shown, the method includes:
[0031] S110. Receive a data query request and convert it into a column data query request.
[0032] The column data query request includes the first timestamp information of the data query request being initiated.
[0033] It should be noted that a data query request is initiated by a user or the system to retrieve data from a database. In this embodiment of the invention, the database for retrieving data supports both row-oriented and column-oriented storage. For example, the database for retrieving data can be a distributed HTAP database. Transforming a data query request into a column data query request refers to converting the data query request into a query request executable by column-oriented storage or a column-oriented engine. For example, for a column data query request, only the required column data is read.
[0034] It should also be noted that the first timestamp information of initiating a data query request can represent the timestamp of the time when the data query request was initiated, that is, the time stamp of the moment when the data query request entered the system or was created. The first timestamp information of initiating a data query request can also represent the timestamp of the time when the data query request was committed to disk in row storage, that is, the time stamp of the moment when the data query request was written to disk in row storage.
[0035] Specifically, upon receiving a data query request from a client, the system first records the first timestamp information of the data query request, and then parses the data query request. If it is determined that the data query request meets the columnar execution conditions, the original data query request is rewritten, thereby transforming the data query request into a columnar data query request; and the first timestamp information is carried in the generated columnar data query request.
[0036] S120. Based on the first timestamp information in the column data query request and the latest update time information of at least one sub-table, determine at least one target data table to be accessed.
[0037] The at least one target data table includes at least one sub-table and / or a main table associated with at least one sub-table.
[0038] It's important to note that a secondary table refers to a derived table associated with the primary table, used to store column data from the primary table. All data in each secondary table originates from the primary table. Secondary tables typically extract column data from the primary table through synchronization or refresh mechanisms and store it in a column-specific format. Typical forms of secondary tables include column-stored copies of the primary table, column-organized projected tables, column-indexed tables, or materialized column-stored tables. The latest update time information of a secondary table refers to the timestamp corresponding to the most recent data synchronization or refresh process completed from the primary table, and the timestamp indicating that the update result has been committed and is visible for subsequent data queries. The latest update time information of a secondary table characterizes the latest time boundary currently covered by the column data synchronized from the primary table, i.e., the latest available time point for column data that the secondary table can provide.
[0039] It's also important to clarify that the target data table refers to the set of table objects that this column data query request actually needs to access. The target data table may only access the secondary table, or it may access the primary table if the secondary table is insufficient, or a combination of both the primary and secondary tables may be used to ensure the correctness of the results. The primary table refers to the source table or base table where the business logic is written. In the primary table, row-level storage typically handles transaction updates. The data in the secondary table is usually derived from or related to the primary table.
[0040] Optionally, if the first timestamp information in the column data query request is earlier than the latest update time information of at least some of the sub-tables, the main table and the table determined from at least some of the sub-tables according to the column data query request shall be used as at least one target data table; if the first timestamp information in the column data query request is later than the latest update time information of at least one sub-table, the main table shall be determined as the target data table.
[0041] It's important to note that if the first timestamp in the column data query request is earlier than the latest update time of some of the sub-tables, it means that the data in those sub-tables has been updated to the point where it covers the first timestamp in the column data query request. This indicates that the column data in the sub-tables, synchronized with the main table, is sufficiently new for this column data query request. In this case, the main table and the tables selected from these qualified sub-tables can be used together as the target tables for this column data query request.
[0042] It should also be noted that if the latest update time of a certain secondary table lags behind the first timestamp, it means that the secondary table has not yet been synchronized or refreshed to a point in time sufficient to cover the expected time of this column data query request. Reading from this secondary table may result in reading outdated column data. To avoid reading stale data, the system determines the primary table as the target data table to ensure data freshness and consistency.
[0043] Specifically, after determining the latest update time information of each sub-table associated with the main table, the system identifies at least one target data table accessed by the column data query request based on the first timestamp information in the column data query request and the latest update time information of the sub-table. The identified target data table may include sub-tables, the main table, or both.
[0044] S130. If at least one target data table includes a main table, query the target column data corresponding to the column data query request from the table update record table associated with the main table and at least one target data table.
[0045] The table associated with the main table is a log table or change log that records data change events in the main table, used for incremental replay. The target column data refers to the data result corresponding to the set of columns requested in the column data query request.
[0046] It's important to note that when the system determines that the current column data query request depends on the main table, it not only reads the existing data in the target table but also reads the incremental change information of the main table recorded in the table update record table when generating the final target column data. Since the column data in the main table may not be synchronized in a timely manner, the latest incremental changes from the main table are overlaid into the target column data through the table update record table to ensure that the target column data is not outdated. Furthermore, the table update record stamp is used to filter out changes that should be visible before the first timestamp information, thus returning column data that is semantically consistent with the column data query request.
[0047] Optionally, determine the data query identifier associated with the column data query request, retrieve the first column data that has not yet been updated to the main table from the table update record table; and determine the second column data from at least one target data table based on the column data query request; and determine the target column data based on the first column data and the second column data.
[0048] The data query identifier refers to the latest update time information in the table update record table, that is, the timestamp of the most recent row change written and visible to the query in the table update record table. The first column of data that has not yet been updated to the main table refers to the incremental change data. The first column of data exists in memory but has not yet been merged into the current queryable state of the main table. The first column of data is retrieved from memory based on the metadata pointing to the first column of data recorded in the table update record table. The second column of data refers to the baseline data that has been written to disk, which is only the column data read from the target data table by column data query request, usually the existing part that has been written to disk.
[0049] Specifically, first, the data query identifier associated with the column data query request is determined, which is the latest update time information in the table update record table. After determining the data query identifier, this column data query request needs to be aligned with the latest update time information of the table update record table. Based on the latest update time information of the table update record table, those change records that have not yet been updated or merged into the main table are extracted from memory and organized into the first column of data related to the requested column, filling in the latest column changes that are not yet reflected in the main table. Then, according to the column data query request, existing column data is read from at least one target data table to obtain the second column of data. The first column of data and the second column of data are merged to output the target column data that satisfies the column data query request.
[0050] In this embodiment, the first column of data is filtered based on the primary key to obtain the updated first column of data, and then presented in a preset order; the target column of data is determined based on the filtered first column of data and the second column of data.
[0051] It's important to note that a primary key is a key used to uniquely identify a column of data. The primary key is used to determine if data in the same column exists in the table's update records, thus deleting data with an earlier update time. Filtering the first column of data by primary key resolves conflicts arising from the same primary key in two data sources. The updated first column refers to the result set after processing the first column by the primary key. In the updated first column, the latest record with the same primary key is retained based on its latest update time and used as the incremental input for subsequent merging. Presenting data according to a preset order means presenting it according to agreed-upon output or merging order rules. For example, sorting by the latest update time ensures the merging process is repeatable and the results are stable.
[0052] Specifically, after obtaining the updated first column of data, when merging the updated first column of data with the second column of data, if a certain primary key appears in both the first column of data and the second column of data, the record corresponding to the first column of data is retained, and the record of the primary key in the second column of data is removed. After the merging is completed, the final target column data is obtained.
[0053] The technical solution of this disclosure first receives a data query request and converts it into a column data query request. The column data query request includes a first timestamp information initiating the data query request. Then, based on the first timestamp information in the column data query request and the latest update time information of at least one sub-table, at least one target data table to be accessed is determined. This target data table includes at least one sub-table and / or a main table associated with at least one sub-table. Finally, if the target data table includes a main table, the target column data corresponding to the column data query request is queried from the table update record table associated with the main table and the at least one target data table. This solves the problems in the prior art where, when addressing the consistency of row-store and column-store data queries, each data update requires simultaneous waiting for both row-store and column-store transactions to be committed before the update is considered successful. These problems make it difficult to meet the real-time requirements of HTAP hybrid services, increase write and commit times, reduce concurrent throughput, and weaken the TP's guarantee of low latency and high performance. This embodiment of the disclosure implements querying the target column data corresponding to the column data query request based on the timestamp of the column data query request and the latest update time information of the sub-table. This enables the row storage and column storage to be read based on the same time version in the same query, ensuring that the column storage query results are consistent with the row storage transaction data, thereby improving the accuracy and reliability of the column storage data query results.
[0054] Example 2
[0055] Figure 2This is a flowchart illustrating a column data query method applied to a database according to an embodiment of the present invention. Based on the foregoing embodiments, it provides a more detailed explanation of updating row data in the main table. For specific implementation details, please refer to the technical solution of this embodiment. Technical terms that are the same as or corresponding to those in the above embodiments will not be repeated here.
[0056] like Figure 2 As shown, the method specifically includes the following steps:
[0057] S210. Create a master table that supports mixed rows and columns.
[0058] It should be noted that the main table can store data in both row-based and column-based storage, thus enabling efficient row-based operations such as point lookups or updates, as well as column-based operations such as column-based analysis or projection.
[0059] Specifically, a master table that supports both row and column queries is created, allowing the database to query data both row-wise and column-wise. When accessing the same business data, a master table is created within the system. This master table structure possesses both the inherent capacity to hold row-level records and the ability to extract and reconstruct column-level data independently.
[0060] S220. In response to detecting a data update event that updates row data in the main table, retrieve at least one piece of sub-data associated with the data update event and update the table update record table with at least one piece of sub-data.
[0061] The table update record includes the row identifier corresponding to the row data, the update time information that initiated the data update, and the updated row data content.
[0062] It's important to note that a data update event refers to an event that updates row data in the main table. Sub-data refers to update-related data extracted from the data update event for recording or synchronization. A row identifier is a unique identifier for a row of data, which can be the primary key of that row. The update time information refers to the timestamp of the update, used to determine the order and increment range. The updated row data content refers to the content of the row after the update, which can be the entire new value or the new value of the modified fields.
[0063] Specifically, when an update is made to a row in the main table, at least one piece of sub-data related to this update is retrieved, and then this information is written to or updated in the table's update record table, forming a change record. In other words, as soon as the main table is updated, the update result is recorded in the table's update record table.
[0064] Optionally, the column data in the main table is updated based on at least one piece of data in the table update record table; and, in response to an event that the processing of at least one piece of data in the table update record table is completed, at least one secondary table associated with the main table is updated based on the updated main table.
[0065] It should be noted that the system first retrieves one or more sub-data entries from the table update record table, and then uses these sub-data entries to modify the corresponding column values in the main table. Once it is confirmed that a sub-data entry has been successfully used to update the main table, a processing completion event is triggered. Then, based on the updated main table, one or more slave tables associated with the main table are updated.
[0066] It should also be noted that after updating the column data in the main table based on at least one piece of sub-data in the table update record table, the row identifier corresponding to the corresponding row data, the update time information that initiated the data update, and the updated row data content are deleted from the table update record table.
[0067] The technical solution of this disclosure embodiment creates a master table that supports mixed row and column operations. In response to detecting a data update event that updates row data in the master table, at least one piece of sub-data associated with the data update event is obtained, and this at least one piece of sub-data is updated in the table update record table. The column data in the master table is updated based on at least one piece of sub-data in the table update record table; and, in response to an event indicating that processing based on at least one piece of sub-data in the table update record table is complete, at least one secondary table associated with the master table is updated based on the updated master table. By first updating the column data of the master table based on the table update record table and then synchronously updating the relevant secondary tables after processing, data consistency and timing correctness between the master table and the secondary tables are ensured, improving real-time performance and stability in column query scenarios.
[0068] Example 3
[0069] As an optional embodiment of the present invention, an example is provided to further illustrate the invention.
[0070] It should be noted that after the worker node of the query execution layer identifies the data that needs to be read from the table update record table through the first timestamp information and the latest update time information of at least one secondary table, it will construct a derived class instance based on the operator used to scan the table update record table. This instance will construct an iterator that connects to the table update record table to read block data from the table update record table in a streaming manner in accordance with the current data reading method of the column storage worker node, and merge it with the block data read by other regular processes to form the final query structure and return it.
[0071] It should be noted that in a typical columnar storage query process, multiple operators are constructed to read the target data table, i.e., the disk data. When the table update record table is identified as the target table to be read, in addition to constructing operators to read the disk data, an operator for the table update record table is also constructed to read the data in the table update record table, and all relevant data is obtained based on the first timestamp information and the latest update time information of at least one secondary table.
[0072] The technical solution of this disclosure improves data consistency and correctness by using a merged reading mechanism that combines disk data with incremental update records. This allows for the return of consistent query results even when the secondary table is not fully synchronized. Furthermore, it reads the table update records in a columnar block streaming manner and merges them with regular blocks, reducing additional data movement and complex modifications, thus improving execution efficiency and project reusability.
[0073] Example 4
[0074] Figure 3 This is a schematic diagram of the structure of a column data query device applied to a database provided in an embodiment of this disclosure, as shown below. Figure 3 As shown, the device includes: a column data query request conversion module 310, a target data table determination module 320, and a target column data query module 330.
[0075] A column data query request conversion module is used to receive a data query request and convert the data query request into a column data query request; wherein the column data query request includes a first timestamp information of initiating the data query request; a target data table determination module is used to determine at least one target data table to be accessed based on the first timestamp information in the column data query request and the latest update time information of at least one sub-table, wherein the at least one target data table includes at least one sub-table and / or a main table associated with the at least one sub-table; a target column data query module is used to, when the at least one target data table includes a main table, query the target column data corresponding to the column data query request from the table update record table associated with the main table and the at least one target data table.
[0076] The technical solution of this disclosure first receives a data query request and converts it into a column data query request. The column data query request includes a first timestamp information initiating the data query request. Then, based on the first timestamp information in the column data query request and the latest update time information of at least one sub-table, at least one target data table to be accessed is determined. This target data table includes at least one sub-table and / or a main table associated with at least one sub-table. Finally, if the target data table includes a main table, the target column data corresponding to the column data query request is queried from the table update record table associated with the main table and the at least one target data table. This solves the problems in the prior art where, when addressing the consistency of row-store and column-store data queries, each data update requires simultaneous waiting for both row-store and column-store transactions to be committed before the update is considered successful. These problems make it difficult to meet the real-time requirements of HTAP hybrid services, increase write and commit times, reduce concurrent throughput, and weaken the TP's guarantee of low latency and high performance. This embodiment of the disclosure implements querying the target column data corresponding to the column data query request based on the timestamp of the column data query request and the latest update time information of the sub-table. This enables the row storage and column storage to be read based on the same time version in the same query, ensuring that the column storage query results are consistent with the row storage transaction data, thereby improving the accuracy and reliability of the column storage data query results.
[0077] Based on the above technical solutions, the device further includes: a main table creation module and a sub-data update module.
[0078] The main table creation module is used to create main tables that support mixed rows and columns;
[0079] The sub-data update module is used to respond to a data update event that updates row data in the main table, obtain at least one sub-data associated with the data update event, and update the at least one sub-data to the table update record table.
[0080] The table update record includes the row identifier corresponding to the row data, the update time information that initiated the data update, and the updated row data content.
[0081] Based on the above technical solutions, the sub-data update module is further configured to update the column data in the main table based on at least one sub-data in the table update record table; and, in response to the completion of the processing of at least one sub-data in the table update record table, update at least one secondary table associated with the main table based on the updated main table.
[0082] Based on the above technical solutions, the target data table determination module 320 is further configured to, when the first timestamp information in the column data query request is earlier than the latest update time information of at least some of the sub-tables, take the main table and the table determined from at least some of the sub-tables according to the column data query request as the at least one target data table; and to determine the main table as the target data table when the first timestamp information in the column data query request is later than the latest update time information of the at least one sub-table.
[0083] Based on the above technical solutions, the target column data query module 330 includes: a first column data acquisition submodule, a second column data determination submodule, and a target column data determination submodule.
[0084] The first column data acquisition submodule is used to determine the data query identifier associated with the column data query request and to obtain the first column data that has not yet been updated to the main table from the table update record table;
[0085] The second column data determination submodule is used to determine the second column data from the at least one target data table based on the column data query request.
[0086] The target column data determination submodule is used to determine the target column data based on the first column data and the second column data.
[0087] Based on the above technical solutions, the target column data determination submodule is further configured to filter the first column data according to the primary key of the first column data to obtain updated first column data, and present it according to a preset order; and determine the target column data based on the filtered first column data and the second column data.
[0088] The column data query device for databases provided in this disclosure can execute the column data query method for databases provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
[0089] It is worth noting that the various units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the protection scope of the embodiments of this disclosure.
[0090] Example 5
[0091] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Refer to the following... Figure 4 It illustrates an electronic device suitable for implementing embodiments of the present disclosure (e.g., Figure 4The diagram below shows the structure of the terminal device or server 500. The terminal device in this embodiment may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital radio receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), and vehicle terminals (e.g., vehicle navigation terminals). Figure 4 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0092] like Figure 4 As shown, electronic device 500 may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 502 or a program loaded from storage device 508 into random access memory (RAM) 503. The RAM 503 also stores various programs and data required for the operation of electronic device 500. The processing unit 501, ROM 502, and RAM 503 are interconnected via bus 504. An edit / output (I / O) interface 505 is also connected to bus 504.
[0093] Typically, the following devices can be connected to I / O interface 505: input devices 506 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 507 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 508 including, for example, magnetic tapes, hard disks, etc.; and communication devices 509. Communication device 509 allows electronic device 500 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 4 An electronic device 500 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0094] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 509, or installed from a storage device 508, or installed from a ROM 502. When the computer program is executed by the processing device 501, it performs the functions defined in the methods of embodiments of this disclosure.
[0095] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0096] The electronic device provided in this embodiment and the column data query method applied to the database provided in the above embodiment belong to the same inventive concept. Technical details not described in detail in this embodiment can be found in the above embodiments, and this embodiment has the same beneficial effects as the above embodiments.
[0097] Example 6
[0098] This disclosure provides a computer storage medium storing a computer program that, when executed by a processor, implements the column data query method for databases provided in the above embodiments.
[0099] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0100] In some implementations, the server may communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and may interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0101] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0102] The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to:
[0103] Receive a data query request and convert the data query request into a column data query request; wherein the column data query request includes the first timestamp information of the data query request initiating the data query request;
[0104] Based on the first timestamp information in the column data query request and the latest update time information of at least one sub-table, determine at least one target data table to be accessed, wherein the at least one target data table includes at least one sub-table and / or a main table associated with the at least one sub-table;
[0105] If the at least one target data table includes a main table, the target column data corresponding to the column data query request is queried from the table update record table associated with the main table and the at least one target data table.
[0106] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including but not limited to object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0107] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0108] The units described in the embodiments of this disclosure can be implemented in software or hardware. The names of the units are not, in some cases, intended to limit the specific unit.
[0109] The functions described above in this document can be performed at least in part by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-a-chip (SoCs), complex programmable logic devices (CPLDs), and so on.
[0110] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0111] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0112] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0113] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.
Claims
1. A column data query method applied to a database, characterized in that, include: Receive a data query request and convert the data query request into a column data query request; wherein the column data query request includes the first timestamp information of the data query request initiating the data query request; Based on the first timestamp information in the column data query request and the latest update time information of at least one sub-table, determine at least one target data table to be accessed, wherein the at least one target data table includes at least one sub-table and / or a main table associated with the at least one sub-table; If the at least one target data table includes a main table, the target column data corresponding to the column data query request is queried from the table update record table associated with the main table and the at least one target data table.
2. The method according to claim 1, characterized in that, The method further includes: Create a main table that supports mixed rows and columns; In response to detecting a data update event that updates row data in the main table, at least one piece of sub-data associated with the data update event is obtained, and the at least one piece of sub-data is updated in the table update record table; The table update record includes the row identifier corresponding to the row data, the update time information that initiated the data update, and the updated row data content.
3. The method according to claim 2, characterized in that, When updating the at least one piece of sub-data to the table update record table, the method further includes: The column data in the main table is updated based on at least one piece of sub-data in the table update record table; and, In response to an event that at least one sub-data record in the table has been updated based on the table, at least one sub-table associated with the main table is updated based on the updated main table.
4. The method according to claim 1, characterized in that, The step of determining the at least one target data table to be accessed based on the first timestamp information in the column data query request and the latest update time information of at least one sub-table includes: When the first timestamp information in the column data query request is earlier than the latest update time information of at least some of the sub-tables, the main table and the table determined from at least some of the sub-tables according to the column data query request are taken as the at least one target data table. When the first timestamp information in the column data query request is later than the latest update time information in at least one of the sub-tables, the main table is determined to be the target data table.
5. The method according to claim 1, characterized in that, The step of querying the target column data corresponding to the column data query request from the table update record table associated with the main table and the at least one target data table includes: Determine the data query identifier associated with the column data query request, and retrieve the first column data that has not yet been updated to the main table from the table update record table; and, The second column of data is determined from the at least one target data table based on the column data query request; The target column data is determined based on the data in the first column and the data in the second column.
6. The method according to claim 5, characterized in that, Determining the target column data based on the first column data and the second column data includes: The data in the first column is filtered based on the primary key to obtain the updated data in the first column, and then presented in a preset order. The target column data is determined based on the filtered first column data and the second column data.
7. A column data query device applied to a database, characterized in that, include: A column data query request conversion module is used to receive a data query request and convert the data query request into a column data query request; wherein, the column data query request includes a first timestamp information of the data query request being initiated; The target data table determination module is used to determine at least one target data table to be accessed based on the first timestamp information in the column data query request and the latest update time information of at least one sub-table, wherein the at least one target data table includes at least one sub-table and / or a main table associated with the at least one sub-table; The target column data query module is used to query the target column data corresponding to the column data query request from the table update record table associated with the main table and the at least one target data table, when the at least one target data table includes a main table.
8. An electronic device, characterized in that, The electronic device includes: One or more processors; Storage device for storing one or more programs. When one or more programs are executed by one or more processors, the one or more processors implement the column data query method applied to a database as described in any one of claims 1-6.
9. A storage medium containing computer-executable instructions, characterized in that, The computer-executable instructions, when executed by a computer processor, are used to perform the column data query method applied to a database as described in any one of claims 1-6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the column data query method applied to a database as described in any one of claims 1-6.