Data processing method and system
AssigneeHuawei Cloud Computing Technologies Co., Ltd.
InventorsWeihua Shan, Hui Yin
Life of this patent
Estimating the term…
Abstract
Embodiments of this application provide a data processing method in a database. A plurality of aggregation intervals are selected, wherein the plurality of aggregation intervals are different from each other. And at least one piece of data in the database is aggregated separately based on each aggregation interval, so that data clusters stored in the database have data ranges with different attribute value spans.
Claims17
A data processing method in a database, wherein the method comprises:
- obtaining, using at least one processor coupled to a memory storing the database, at least one piece of data, wherein each said at least one piece of data comprises at least two attributes;
- separately performing aggregation calculation, using the at least one processor and based on M aggregation intervals, on an attribute value of a first target attribute of the at least one piece of data to obtain T data clusters, wherein the M aggregation intervals are different from each other and are intervals of a second target attribute of the at least two attributes, each data cluster of the T data clusters comprises an aggregate value, the aggregate value of said each data cluster is obtained by performing aggregation calculation on attribute values of the first target attribute of pieces of data having attribute values of the second target attribute belonging to a data range corresponding to the data cluster, a span of the data range being equal to a respective one of the M aggregation intervals, M is an integer greater than or equal to 2, and T≥M, wherein each aggregation layer of M aggregation layers corresponds to one aggregation interval of the M aggregation intervals, any two adjacent aggregation intervals of the M aggregation intervals have a parent-child relationship in which a parent aggregation interval of said any two aggregation intervals is an integer multiple of a child aggregation interval of said any two aggregation intervals;
- storing, using the at least one processor, the T data clusters in the database in the memory, wherein each data cluster of the T data clusters is stored in the database in a respective data structure that comprises the aggregate value of the each data cluster and that is associated in the database with a data structure of a corresponding one of the M aggregation layers;
- receiving, using the at least one processor, a query request, wherein the query request comprises a query range;
- obtaining from the database, through query using the at least one processor, at least two data clusters from the M aggregation layers based on the query range, wherein the obtained at least two data clusters belong to different aggregation layers, a data range of each data cluster of the obtained at least two data clusters intersects with the query range, and a union set of the data ranges of all the obtained at least two data clusters is the same as the query range;
- and
- performing, using the at least one processor, aggregation calculation on aggregate values comprised in the obtained at least two data clusters, to obtain a query result.
A computing device, wherein the computing device comprises a processor and a memory, and the processor is configured to execute a program instruction in the memory to implement operations comprising:
- obtaining at least one piece of data, wherein each said at least one piece of data comprises at least two attributes;
- separately performing aggregation calculation, based on M aggregation intervals, on an attribute value of a first target attribute of the at least one piece of data to obtain T data clusters, wherein the M aggregation intervals are different from each other and are intervals of a second target attribute of the at least two attributes, each data cluster of the T data clusters comprises an aggregate value, the aggregate value of said each data cluster is obtained by performing aggregation calculation on attribute values of the first target attribute of pieces of data having attribute values of the second target attribute belonging to a data range corresponding to the data cluster, a span of the data range being equal to a respective one of the M aggregation intervals, M is an integer greater than or equal to 2, and T≥M, wherein each aggregation layer of M aggregation layers corresponds to one aggregation interval of the M aggregation intervals, any two adjacent aggregation intervals of the M aggregation intervals have a parent-child relationship in which a parent aggregation interval of said any two aggregation intervals is an integer multiple of a child aggregation interval of said any two aggregation intervals;
- storing the T data clusters in a database in the memory, wherein each data cluster of the T data clusters is stored in the database in a respective data structure that comprises the aggregate value of the each data cluster and that is associated in the database with a data structure of a corresponding one of the M aggregation layers;
- receiving a query request, wherein the query request comprises a query range;
- obtaining from the database, through query, at least two data clusters from the M aggregation layers based on the query range, wherein the obtained at least two data clusters belong to different aggregation layers, a data range of each data cluster of the obtained at least two data clusters intersects with the query range, and a union set of the data ranges of all the obtained at least two data clusters is the same as the query range;
- and
- performing aggregation calculation on aggregate values comprised in the obtained at least two data clusters, to obtain a query result.
A non-transitory computer readable storage medium, wherein the non-volatile computer readable storage medium comprises a computer instruction which, when executed by a processor of a computing device, causes the computing device to perform operations comprising:
- obtaining at least one piece of data, wherein each said at least one piece of data comprises at least two attributes;
- separately performing aggregation calculation, based on M aggregation intervals, on an attribute value of a first target attribute of the at least one piece of data to obtain T data clusters, wherein the M aggregation intervals are different from each other and are intervals of a second target attribute of the at least two attributes, each data cluster of the T data clusters comprises an aggregate value, the aggregate value of said each data cluster is obtained by performing aggregation calculation on attribute values of the first target attribute of pieces of data having attribute values of the second target attribute belonging to a data range corresponding to the data cluster, a span of the data range being equal to a respective one of the M aggregation intervals, M is an integer greater than or equal to 2, and T≥M, wherein each aggregation layer of M aggregation layers corresponds to one aggregation interval of the M aggregation intervals, any two adjacent aggregation intervals of the M aggregation intervals have a parent-child relationship in which a parent aggregation interval of said any two aggregation intervals is an integer multiple of a child aggregation interval of said any two aggregation intervals;
- storing the T data clusters in a database in a memory, wherein each data cluster of the T data clusters is stored in the database in a respective data structure that comprises the aggregate value of the each data cluster and that is associated in the database with a data structure of a corresponding one of the M aggregation layers;
- receiving a query request, wherein the query request comprises a query range;
- obtaining from the database, through query, at least two data clusters from the M aggregation layers based on the query range, wherein the obtained at least two data clusters belong to different aggregation layers, a data range of each data cluster of the obtained at least two data clusters intersects with the query range, and a union set of the data ranges of all the obtained at least two data clusters is the same as the query range;
- and
- performing aggregation calculation on aggregate values comprised in the obtained at least two data clusters, to obtain a query result.
Dependencies are inferred from the claim text.