WO2017206562A1 - 一种数据表的处理方法、装置及系统 - Google Patents

一种数据表的处理方法、装置及系统 Download PDF

Info

Publication number
WO2017206562A1
WO2017206562A1 PCT/CN2017/075998 CN2017075998W WO2017206562A1 WO 2017206562 A1 WO2017206562 A1 WO 2017206562A1 CN 2017075998 W CN2017075998 W CN 2017075998W WO 2017206562 A1 WO2017206562 A1 WO 2017206562A1
Authority
WO
WIPO (PCT)
Prior art keywords
query
partition
instruction
host
data
Prior art date
Application number
PCT/CN2017/075998
Other languages
English (en)
French (fr)
Inventor
杜培亮
王传廷
黄琳
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2017206562A1 publication Critical patent/WO2017206562A1/zh
Priority to US16/204,526 priority Critical patent/US20190108174A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24553Query execution of query operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/221Column-oriented storage; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • G06F16/278Data partitioning, e.g. horizontal or vertical partitioning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/16Error detection or correction of the data by redundancy in hardware
    • G06F11/20Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements
    • G06F11/202Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements where processing functionality is redundant
    • G06F11/2038Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements where processing functionality is redundant with a single idle spare processing component
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/16Error detection or correction of the data by redundancy in hardware
    • G06F11/20Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements
    • G06F11/202Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements where processing functionality is redundant
    • G06F11/2048Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements where processing functionality is redundant where the redundant components share neither address space nor persistent storage
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2201/00Indexing scheme relating to error detection, to error correction, and to monitoring
    • G06F2201/80Database-specific techniques

Definitions

  • the present application relates to the field of computer technologies, and in particular, to a method, an apparatus, and a system for processing a data table.
  • Partitioning technology is a commonly used technology in database systems. It refers to dividing the rows or columns in the data table that meet different conditions into different regions according to the partition key. That is, dividing the data in the data table into multiple commonalities. Small data areas that logically belong to the same table space (that is, the same data table), but are physically independent of each other. Among them, the divided data table can be called a partition table.
  • the partition pruning technique is usually adopted, that is, the required partition is selected according to the conditions of the query column, and when the partition pruning technique is adopted, the query specified by the where substatement in the query instruction is used.
  • the column must be a partitioning key (used to indicate the attributes of a part of the data, such as the header of one or more columns in the data table, or the header of one or more rows in the data table), so to use the partition pruning technique, Ensure that the partition key of the partition table to be queried is the same as the query column.
  • a partitioning key used to indicate the attributes of a part of the data, such as the header of one or more columns in the data table, or the header of one or more rows in the data table
  • the physical machine can partition the data of the data table according to different partition keys to obtain different partition tables. In this way, when the data in the data table needs to be queried by using the partition pruning technology, the physical machine can directly query in the corresponding partition table to improve the query efficiency.
  • Embodiments of the present invention provide a method, an apparatus, and a system for processing a data table, which can save storage space of a physical machine in a database system cluster, thereby improving data processing performance.
  • an embodiment of the present invention provides a data table processing method, where the processing method is applied to a host in a database system cluster, where the database system cluster includes the host and the standby machine, and the processing method includes: the host acquires the first partition instruction.
  • the first partition instruction includes a first partition key
  • the second partition instruction includes a second partition key different from the first partition key
  • the host according to the first partition instruction, the first data table on the host Data is partitioned according to the first partition key to get the first a partition table
  • the host sends a second partition instruction to the standby machine, where the second partition instruction is used to trigger the standby machine to partition the data of the second data table that is the same as the first data table on the standby machine according to the second partition key to obtain the second Partition Table.
  • the first data table may include data of multiple services, and the data of each service may be understood as a column of data in the first data table, that is, a table in which each service can be understood as a column in the first data table. head.
  • the first partition key can be understood as one of a plurality of services, that is, the first partition key can be understood as a header of a column in the first data table; the first partition table is a partition table corresponding to the service.
  • the second data table, the second partition key, and the second partition table are similar to the first data table, the first partition key, and the first partition table, and are not described herein again.
  • the processing method of the data table provided by the embodiment of the present invention because the first partition table can be obtained by partitioning the first data table on the host according to the first partition key on the host, and the second partition key is different from the first partition key on the standby machine.
  • the partition key is obtained by partitioning the second data table with the same data table as the first data table on the standby machine, that is, the same data table can be partitioned according to different partition keys on the host and the standby machine to obtain different partition tables. Therefore, compared with the prior art, the data table processing method provided by the embodiment of the present invention can reduce the number of partition tables stored in the host and the standby machine because the host and the standby machine do not need to store multiple identical partition tables. It can save the storage space of physical machines (including hosts and backup machines) in the database system cluster, thereby improving the performance of data processing, that is, better management of data.
  • the processing method further includes: the host acquiring a first creation instruction for creating the first data table and a second creation instruction for creating the second data table; and the host is created according to the first The instruction creates a first data table on the host; and the host sends a second create instruction to the standby machine, which is used to trigger the standby machine to create a second data table on the standby machine.
  • the first creation instruction, the second creation instruction, the first partition instruction, and the second partition instruction may all be included in one instruction set.
  • the processing method further includes: acquiring, by the host, a query instruction including a query column and a query condition, the query column being the same as the first partition key, the query instruction being used for querying the first The data in the partition table that satisfies the query condition; the host executes the query instruction on the first partition table.
  • the processing method further includes: acquiring, by the host, a query instruction including a query column and a query condition, where the query column is the same as the second partition key, and the query instruction is used to query the second The data in the partition table that satisfies the query condition; the host sends the query instruction to the standby machine, so that the standby machine executes the query instruction on the second partition table.
  • the first data table on the host is partitioned according to the first partition key
  • the second data table on the standby machine is partitioned according to the second partition key, when the data of a certain service in the data table needs to be queried, if The host determines that the query column in the query instruction is the same as the first partition key, and the host executes the query instruction on the first partition table, that is, the first partition table on the host queries the data that satisfies the query condition; if the host determines the If the query column is different from the first partition key and the second partition key, the host executes the query instruction on the first partition table, that is, the first partition table on the host queries the data that satisfies the query condition; if the host determines The query column is the same as the second partition key, then the host will check The query command is sent to the standby machine, and the standby machine executes the query instruction on the second partition table, that is, the second partition table on the standby machine queries the data that satisfie
  • a partition pruning technique in order to improve the query efficiency when querying data of a service, a partition pruning technique may be adopted in the query process.
  • the so-called partition pruning technique refers to the process of removing unnecessary partitions and extracting the required partitions according to the conditions of the query partition column in the query statement and the query clause in the where clause (ie, the query condition).
  • the partition table is T1
  • T1 is partitioned according to c1
  • the condition of the query column is c1 ⁇ 200.
  • the partition pruning technique can be used to remove other partitions other than c1 ⁇ 200 partitions in T1, and extract the partitions with c1 ⁇ 200. Is the data in T1 that satisfies the query conditions.
  • the processing method further includes: acquiring, by the host, the first query column, the first query condition corresponding to the first query column, the second query column, and the second query column Corresponding second query condition query instruction, the first query column is the same as the first partition key, the second query column is the same as the second partition key, and the relationship between the first query condition and the second query condition is “and”.
  • the query instruction is configured to query data in the first partition table that satisfies the first query condition and the second query condition; and the host executes the query instruction on the first partition table.
  • the processing method further includes: acquiring, by the host, the first query column, the first query condition corresponding to the first query column, the second query column, and the second query column Corresponding second query condition query instruction, the first query column is the same as the first partition key, the second query column is the same as the second partition key, and the relationship between the first query condition and the second query condition is “or”.
  • the query instruction is configured to query data in the first partition table that satisfies the first query condition, and query data in the second partition table that satisfies the second query condition; and the host splits the query instruction into the first query column and the first a first query instruction of the query condition and a second query instruction including the second query column and the second query condition, and the host executing the first query instruction on the first partition table, and the host sends the second query instruction to the standby machine to The standby machine is configured to execute a second query instruction on the second partition table.
  • the host may specifically determine the relationship according to the two query conditions. Which physical machine (host or standby) executes the query instruction. Therefore, based on the partition table obtained by the processing method of the data table provided by the embodiment of the present invention, the query efficiency of querying the partition table can be improved to some extent.
  • the processing method further includes: the host acquiring the modification instruction; and the host modifying the first partition table according to the modification instruction; and the host sending the modification instruction to the standby machine, for triggering the standby machine Modify the second partition table.
  • a physical log is used to synchronize the respective partition table between the host and the standby machine (using physical log synchronization can be understood as: the host sends the modified data to the standby machine, and the standby machine updates the data)
  • the host directly sends the modification instruction (the overhead of modifying the instruction is much smaller than the data overhead) to the standby machine, and the standby machine executes the modification instruction.
  • Modifying its partition table can save the synchronization overhead of synchronization between the first partition table on the host and the second partition table on the standby.
  • an embodiment of the present invention provides a data table processing method, where the processing method is applied to a standby machine in a database system cluster, where the database system cluster includes a host and a standby machine, and the processing method
  • the method includes: receiving, by the standby machine, a partition instruction that is sent by the host, including a partition key; and according to the partition instruction, the standby machine partitions the data of the second data table on the standby machine according to the partition key to obtain a partition table, the second data table, and the host
  • the first data table is the same, and the first data table is partitioned according to a partition key different from the partition key.
  • the partition key of the host partitioning the first data table is referred to as a first partition key, and the partition table obtained by the host after partitioning the first data table is referred to as a first partition table; and the partition key of the standby machine for partitioning the second data table For the second partition key, the partition table obtained by the standby machine after partitioning the second data table is referred to as a second partition table.
  • the processing method of the data table provided by the embodiment of the present invention is the same as the first data table on the host, because the second partition key different from the first partition key partitioned by the first data table on the host machine can be used on the standby machine.
  • the second data table partition is obtained to obtain a second partition table different from the first partition table on the host, that is, the same data table can be partitioned by different partition keys on the host and the standby machine to obtain different partition tables, so
  • the processing method of the data table provided by the embodiment of the present invention can reduce the number of partition tables stored in the host and the standby machine, since the host and the backup machine do not need to store multiple identical partition tables. It can save the storage space of physical machines (including hosts and backup machines) in the database system cluster, thereby improving the performance of data processing, that is, better management of data.
  • the processing method further includes: the standby machine receives a query instruction that is sent by the host, including the query column and the query condition, and the query column is the same as the partition key, and the query instruction is used to query the standby machine.
  • the data in the partition table ie, the second partition table
  • the standby machine executes the query instruction on the partition table on the standby machine.
  • the corresponding query instruction may be executed by different physical machines (host or standby), for example, by the standby machine, including
  • the query instruction of the same query column with the second partition key can improve the query efficiency to some extent.
  • the processing method further includes: the standby machine receives the modification instruction sent by the host; and the standby machine modifies the partition table on the standby machine according to the modification instruction.
  • the host may send the modification instruction to the standby machine by using a logical log synchronization method, and the standby machine modifies the partition on the standby machine according to the modification instruction.
  • Table this can save the synchronization overhead of synchronization between the partition table on the host and the partition table on the standby.
  • an embodiment of the present invention provides a data table processing method, where the processing method is applied to a host in a database system cluster, where the database system cluster includes a host and a standby machine, and the processing method includes: the host acquires the first query.
  • the query instruction is configured to query data in the partition table that satisfies the first query condition; and the first query column is the same as the first partition key of the first partition table
  • the first partition table is obtained by partitioning the data of the first data table on the host according to the first partition key; in the first query column and the second partition table
  • the second partition key is the same, the host sends a query instruction to the standby machine, so that the standby machine executes the query instruction on the second partition table, and the second partition table is the second partition of the data of the second data table on the standby machine.
  • the key partition is obtained, the second data table is the same as the first data table, and the second partition key is different from the first partition key.
  • the processing method of the data table provided by the embodiment of the present invention is that the first partition table is obtained by partitioning the data of the first data table on the host according to the first partition key, and the second partition table is on the standby machine and the first data.
  • the data of the second data table of the same table is obtained according to the second partition key partition. Therefore, when the first query column in the query instruction acquired by the host is the same as the first partition key, the host may perform the first partition table on the first partition table. When the first query column in the query command acquired by the host is the same as the second partition key, the host may send the query instruction to the standby machine, and the standby machine executes the query instruction on the second partition table.
  • the data table processing method provided by the embodiment of the present invention is compared with the prior art, because the same data table can be partitioned by different partition keys on the host and the standby machine to obtain different partition tables.
  • the machine does not need to store multiple identical partition tables, so the number of partition tables stored in the host and the standby can be reduced, thereby saving storage space of physical machines (including hosts and standbys) in the database system cluster, thereby improving data.
  • the performance of the processing that is, the management of the data can be better realized.
  • the query instruction further includes a second query column and a second query condition, and second The query column is the same as the second partition key of the second partition table, and the first query condition and the second query condition are in an AND relationship, and the query instruction is further used to query the data in the first partition table that satisfies the second query condition.
  • the second partition table is obtained by partitioning the data of the second data table on the standby machine according to the second partition key.
  • the second data table is the same as the first data table, and the second partition key is different from the first partition key.
  • the query instruction further includes a second query column and a second query condition
  • second The query column is the same as the second partition key of the second partition table, and the first query condition and the second query condition are in an "or" relationship, and the query instruction is further used to query the data in the second partition table that satisfies the second query condition.
  • the processing method further includes: the host splitting the query instruction into a first query instruction including the first query column and the first query condition, and a second query instruction including the second query column and the second query condition, the second partition table
  • the data of the second data table on the standby machine is obtained according to the second partition key partition, the second data table is the same as the first data table, the second partition key is different from the first partition key; and the host sends the second to the standby machine. Querying instructions, so that the standby machine executes the second query instruction on the second partition table;
  • the method for the host to execute the query instruction on the first partition table includes: the host executing the first query instruction on the first partition table.
  • the host may specifically determine the relationship according to the two query conditions. Which physical machine (host or standby) executes the query instruction. Therefore, based on the partition table obtained by the processing method of the data table provided by the embodiment of the present invention, the query efficiency of querying the partition table can be improved to some extent.
  • an embodiment of the present invention provides a data table processing method, where the processing method is applied to a standby machine in a database system cluster, where the database system cluster includes a host and a standby machine, and the processing method includes: the standby machine receives the host sending
  • the query instruction includes a query column and a query condition, and the query column is the same as the partition key of the partition table, and the query instruction is used to query data in the partition table that satisfies the query condition, and the partition table is the second data on the standby machine.
  • the data of the table is obtained according to the partition key partition,
  • the second data table is the same as the first data table on the host; and the standby machine executes the query instruction on the partition table.
  • the processing method of the data table provided by the embodiment of the present invention is that, when the partition table is obtained by partitioning the data of the second data table that is the same as the first data table on the host machine according to the partition key, the host obtains the query. When the query column in the instruction is the same as the partition key, the host sends the query instruction to the standby machine, and the standby machine executes the query instruction on the partition table.
  • the processing method of the data table provided by the embodiment of the present invention can reduce the number of partition tables stored in the standby machine because the standby machine does not need to store multiple partition tables that are the same as the partition table stored by the host. Therefore, the storage space of the standby machine in the database system cluster can be saved, thereby improving the performance of data processing, that is, the data management can be better realized.
  • an embodiment of the present invention provides a physical machine, where the physical machine is a host in a database system cluster, and the database system cluster includes a host and a backup machine, and the host includes an acquiring unit, an executing unit, and a sending unit.
  • the obtaining unit is configured to acquire a first partition instruction including a first partition key and a second partition instruction including a second partition key, where the second partition key is different from the first partition key; and the execution unit is configured to acquire the first partition according to the obtaining unit
  • the instruction, the data of the first data table on the host is partitioned according to the first partition key to obtain a first partition table
  • the sending unit is configured to send, to the standby machine, a second partition instruction acquired by the acquiring unit, where the second partition instruction is used.
  • the data of the second data table that is the same as the first data table on the standby machine is triggered to be partitioned according to the second partition key to obtain the second partition table.
  • the physical machine provided by the embodiment of the present invention is a host in a database system cluster.
  • the first partition table can be obtained by partitioning the first data table on the host according to the first partition key on the host, and the first partition key is pressed on the standby machine.
  • Different second partition keys are used to partition the second data table with the same data table as the first data table to obtain a second partition table, that is, the same data table can be partitioned according to different partition keys on the host and the standby machine to obtain different
  • the partition table therefore, compared with the prior art, the data table processing method provided by the embodiment of the present invention can reduce the partitions stored in the host and the standby machine because neither the host nor the standby machine need to store multiple identical partition tables.
  • the number of tables can save the storage space of physical machines (including hosts and backup machines) in the database system cluster, thereby improving the performance of data processing, that is, better management of data.
  • the physical machine includes, but is not limited to, the acquiring unit, the executing unit, and the sending unit in the foregoing fifth aspect, and the functions of the acquiring unit, the executing unit, and the sending unit in the foregoing fifth aspect.
  • the physical machine may include units/modules for performing the processing method of the data table described in the above first aspect and various alternative manners of the first aspect, the units/modules being for performing the first aspect and the first aspect described above Various alternative ways of processing the data table described, while logically dividing the physical machine.
  • an embodiment of the present invention provides a physical machine, where the physical machine is a standby machine in a database system cluster, where the database system cluster includes a host and a standby machine, and the standby machine includes a receiving unit and an execution unit.
  • the receiving unit is configured to receive a partition instruction that is sent by the host and includes a partition key; the execution unit is used for the root According to the partition instruction received by the receiving unit, the data of the second data table on the standby machine is partitioned according to the partition key to obtain a partition table, and the second data table is the same as the first data table on the host, and the first data table is in accordance with the partition.
  • the partition key partition is different.
  • the partition key of the host partitioning the first data table is referred to as a first partition key, and the partition table obtained by the host after partitioning the first data table is referred to as a first partition table; and the partition key of the standby machine for partitioning the second data table For the second partition key, the partition table obtained by the standby machine after partitioning the second data table is referred to as a second partition table.
  • the physical machine provided by the embodiment of the present invention is a standby machine in the database system cluster, and the second partition key different from the first partition key of the first data table partitioned on the host machine may be used on the standby machine, and the second partition key on the host
  • a second data table partition with the same data table to obtain a second partition table different from the first partition table on the host, that is, the same data table can be partitioned according to different partition keys on the host and the standby machine to obtain different
  • the partition table therefore, compared with the prior art, the data table processing method provided by the embodiment of the present invention can reduce the partitions stored in the host and the standby machine because neither the host nor the standby machine need to store multiple identical partition tables.
  • the number of tables can save the storage space of physical machines (including hosts and backup machines) in the database system cluster, thereby improving the performance of data processing, that is, better management of data.
  • the physical machine provided by the embodiment of the present invention includes but is not limited to the receiving unit and the executing unit in the sixth aspect, and the functions of the receiving unit and the executing unit in the sixth aspect include, but are not limited to, the foregoing description.
  • the physical machine may include units/modules for performing the processing method of the data table described in the second aspect and the various alternative manners of the second aspect, the units/modules being configured to perform the second aspect and the second aspect described above Various alternative ways of processing the data table described, while logically dividing the physical machine.
  • an embodiment of the present invention provides a physical machine, where the physical machine is a host in a database system cluster, and the database system cluster includes a host and a standby machine, and the host includes an acquiring unit, an executing unit, and a sending unit.
  • the obtaining unit is configured to obtain a first query condition query instruction corresponding to the first query column, where the query instruction is used to query data in the partition table that satisfies the first query condition; and the execution unit is used in the first query If the column is the same as the first partition key of the first partition table, the query instruction acquired by the obtaining unit is executed on the first partition table, and the first partition table is the data of the first data table on the host according to the first partition key.
  • a sending unit configured to send, by the acquiring unit, a query instruction acquired by the acquiring unit, in the case that the first query column and the second partitioning key of the second partitioning table are the same, so that the standby machine performs the second partitioning table
  • the query instruction, the second partition table is obtained by partitioning the data of the second data table on the standby machine according to the second partition key, the second data table is the same as the first data table, and the second partition key is different from the first partition key.
  • the physical machine provided by the embodiment of the present invention is a host in a database system cluster, because the first partition table is obtained by partitioning the data of the first data table on the host according to the first partition key, and the second partition table is on the standby machine.
  • the data of the second data table identical to the first data table is obtained according to the second partition key partition, so when the first query column in the query instruction acquired by the host is the same as the first partition key, The query instruction is executed by the host to the first partition table.
  • the host may send the query command to the standby machine, and the standby device sends the query command to the standby device.
  • the second partition table executes the query instruction.
  • the data table processing method provided by the embodiment of the present invention is compared with the prior art, because the same data table can be partitioned by different partition keys on the host and the standby machine to obtain different partition tables.
  • the machine does not need to store multiple identical partition tables, so the number of partition tables stored in the host and the standby can be reduced, thereby saving storage space of physical machines (including hosts and standbys) in the database system cluster, thereby improving data.
  • the performance of the processing that is, the management of the data can be better realized.
  • the physical machine provided by the embodiment of the present invention includes but is not limited to the acquiring unit and the executing unit in the foregoing seventh aspect, and the functions of the acquiring unit and the executing unit in the foregoing seventh aspect include, but are not limited to, the foregoing description.
  • the physical machine may include units/modules for performing the processing method of the data table described in the above third aspect and various alternative manners of the third aspect, the units/modules being for performing the above third aspect and the third aspect Various alternative ways of processing the data table described, while logically dividing the physical machine.
  • an embodiment of the present invention provides a physical machine, where the physical machine is a standby machine in a database system cluster, where the database system cluster includes a host and a standby machine, and the standby machine includes a receiving unit and an execution unit.
  • the receiving unit is configured to receive a query instruction that is sent by the host, including a query column and a query condition, where the query column is the same as the partition key of the partition table, and the query instruction is used to query data in the partition table that satisfies the query condition, and the partition table is The data of the second data table on the standby machine is obtained according to the partition key partition, and the second data table is the same as the first data table on the host; the execution unit is configured to execute the query instruction received by the receiving unit on the partition table.
  • the physical machine provided by the embodiment of the present invention is a standby machine in a database system cluster. Since the partition table is obtained by partitioning the data of the second data table that is the same as the first data table on the host machine according to the partition key, When the query column in the query instruction acquired by the host is the same as the partition key, the host sends the query instruction to the standby machine, and the standby machine executes the query instruction on the partition table.
  • the processing method of the data table provided by the embodiment of the present invention can reduce the number of partition tables stored in the standby machine because the standby machine does not need to store multiple partition tables that are the same as the partition table stored by the host. Therefore, the storage space of the standby machine in the database system cluster can be saved, thereby improving the performance of data processing, that is, the data management can be better realized.
  • the physical machine provided by the embodiment of the present invention includes but is not limited to the receiving unit and the executing unit in the foregoing eighth aspect, and the functions of the receiving unit and the executing unit in the foregoing eighth aspect include, but are not limited to, the foregoing description.
  • the physical machine may include units/modules for performing the processing method of the data table described in the above fourth aspect and various alternative manners of the fourth aspect, the units/modules being configured to perform the fourth aspect and the fourth aspect described above Various alternative ways of processing the data table described, while logically dividing the physical machine.
  • an embodiment of the present invention provides a physical machine, where the physical machine is a database system cluster.
  • the host in the database system includes a host and a standby, and the host includes a processor, an interface circuit, a memory, and a system bus.
  • the memory is used to store computer execution instructions, and the processor, the interface circuit and the memory are connected to each other through a system bus.
  • the processor executes the computer stored instructions of the memory storage to enable the host to execute the first aspect or any one of the above.
  • the processing method of the data table described in the selection mode is used to store computer execution instructions, and the processor, the interface circuit and the memory are connected to each other through a system bus.
  • an embodiment of the present invention provides a readable storage medium, where the readable storage medium includes a computer execution instruction, and when the host is running, the processor of the host executes a computer to execute an instruction, so that the host performs the first aspect or The processing method of the data table described in any of the alternative manners.
  • an embodiment of the present invention provides a physical machine, where the physical machine is a standby machine in a database system cluster, where the database system cluster includes a host and a backup machine, and the standby machine includes a processor, an interface circuit, a memory, and a system. bus.
  • the memory is used to store computer execution instructions, and the processor, the interface circuit and the memory are connected to each other through a system bus.
  • the processor executes the memory storage computer execution instruction to enable the standby machine to execute the second aspect or any one of the above.
  • an embodiment of the present invention provides a readable storage medium, where the readable storage medium includes a computer executing instruction, and when the standby machine is running, the processor of the standby machine executes a computer to execute an instruction, so that the standby machine executes the second A method of processing a data table as described in the aspect or any alternative thereof.
  • an embodiment of the present invention provides a physical machine, where the physical machine is a host in a database system cluster, the database system cluster includes a host and a standby machine, and the host includes a processor, an interface circuit, a memory, and a system bus.
  • the memory is used to store computer execution instructions, and the processor, the interface circuit and the memory are connected to each other through a system bus.
  • the processor executes the computer stored instructions of the memory storage to enable the host to execute the third aspect or any one of the foregoing.
  • the processing method of the data table described in the selection mode is used to store computer execution instructions, and the processor, the interface circuit and the memory are connected to each other through a system bus.
  • an embodiment of the present invention provides a readable storage medium, where the readable storage medium includes a computer execution instruction, and when the host is running, the processor of the host executes a computer to execute an instruction, so that the host performs the third aspect or The processing method of the data table described in any of the alternative manners.
  • the memory is used to store computer execution instructions, and the processor, the interface circuit and the memory are connected to each other through a system bus.
  • the processor executes the memory storage computer to execute the instructions, so that the standby machine executes the data described in the fourth aspect.
  • the processing method of the table is used to store computer execution instructions, and the processor, the interface circuit and the memory are connected to each other through a system bus.
  • an embodiment of the present invention provides a readable storage medium, where the readable storage medium includes The computer executes the instruction, and when the standby machine is running, the processor of the standby machine executes the computer to execute the instruction, so that the standby machine executes the processing method of the data table described in the fourth aspect above.
  • an embodiment of the present invention provides a database system cluster, where the database system cluster includes a host and at least one standby machine. among them:
  • the host is the physical machine according to the fifth aspect, wherein the standby device is the physical machine according to the sixth aspect; or the host is the physical machine according to the seventh aspect, wherein the standby device is the foregoing eighth aspect The physical machine; or the host is the physical machine according to the ninth aspect, wherein the standby machine is the physical machine according to the eleventh aspect; or the host is the physics described in the thirteenth aspect
  • the standby machine is the physical machine described in the fifteenth aspect.
  • FIG. 1 is a schematic structural diagram of a database system cluster according to an embodiment of the present invention
  • FIG. 3 is a second schematic diagram of a method for processing a data table according to an embodiment of the present disclosure
  • FIG. 4 is a third schematic diagram of a method for processing a data table according to an embodiment of the present invention.
  • FIG. 6 is a schematic diagram 5 of a method for processing a data table according to an embodiment of the present disclosure
  • FIG. 7 is a first schematic diagram of another method for processing a data table according to an embodiment of the present invention.
  • FIG. 8 is a second schematic diagram of another method for processing a data table according to an embodiment of the present disclosure.
  • FIG. 9 is a schematic structural diagram 1 of a host according to an embodiment of the present disclosure.
  • FIG. 10 is a schematic structural diagram 1 of a standby machine according to an embodiment of the present invention.
  • FIG. 11 is a schematic structural diagram 2 of a host according to an embodiment of the present disclosure.
  • FIG. 12 is a schematic diagram of hardware of a physical machine according to an embodiment of the present invention.
  • A/B can be understood as A or B.
  • first and second and the like in the specification and claims of the present application are used to distinguish different objects, and are not intended to describe a particular order of the objects.
  • first partition table and the second partition table and the like are used to distinguish different partition tables, instead of describing the feature order of the partition table.
  • Partitioning technology refers to dividing the data table into smaller segments according to the partition key. These segments logically belong to the same table space, and physically are independent data. These independent data form several data partitions. .
  • Table space A collection of one or more data tables.
  • Data table A table that includes data for multiple services.
  • the table includes multiple rows and columns, and each column or row corresponds to a service.
  • a service corresponding to each column is taken as an example for description. It should be understood that, in the case that each line corresponds to one service, the solution described in this application can also be performed, and details are not described herein again.
  • each column corresponds to one service
  • the header of each column can be understood as a service
  • the data of each column can be understood as data of one service.
  • Partition key refers to the header of one or more columns that partition the data table, or the header of one or more rows that partition the data table.
  • the partition key is a header of a column that partitions the data table, and it should be understood that the partition key is a plurality of columns, one row or more partitioning the data table.
  • the header of a row the solution described in this application can also be performed, and the specific manner is not described again.
  • the query instruction includes the query column, and correspondingly, in the case of the header of the row corresponding to the partition key, the query column in the query instruction can also be adaptively
  • the method described in the present application can also be executed.
  • the embodiment of the present application uses a partition key as a column header as an example. It should be understood that the partition key corresponds to the header of the row.
  • the solutions described in this application can also be implemented, and details are not described herein.
  • Partition table refers to the data table after partitioning according to the partition key.
  • Partition refers to the process of dividing a row or column in a data table that satisfies different conditions into different regions (also called partitions) according to the partition key. It should be noted that the dividing process usually does not discard other rows or columns in the data table except the row or column in which the partitioning key used by the partitioning is located. For example, suppose the data table has 5 columns. If you partition according to the header of the third column (that is, the partition key), then the partitioned data table (or each partition) still includes 5 columns, that is, after partitioning the data table, each All the columns originally contained in the data table are included in the partition.
  • the data table is partitioned according to the header of a column, except that all the rows of the data table are divided into different partitions, and all the columns in the data table exist in each partition.
  • the data table is partitioned according to the header of a row, except that all columns of the data table are divided into different partitions, and all rows in the data table exist in each partition.
  • the data table may be further partitioned after partitioning
  • the data for each partition is sorted separately so that the data for each partition is physically stored sequentially.
  • the data in the data table may also be sorted first, and then the sorted data table is further partitioned.
  • the partition key can be set as a clustered index, so that the data in the data table is stored in the physical order according to the clustered index, and then the data table after setting the clustered index is divided according to the partition condition of the partition key to complete Partitioning the data table.
  • the partition table is obtained by partitioning the data table according to the partition key, and the partition table may include multiple small tables (each small table is one partition), and multiple small tables may be stored in the same storage space. It can also be stored in different storage spaces. But no matter how many small tables are stored, for the user, multiple small tables are still logically a large table.
  • the first partition table and the second partition table in the present application are logically a large table.
  • Query column refers to the query parameter for querying the data table (or partition table). For example, if the query parameter for querying the data table is c1 (for example, query c1 meets certain conditions), then c1 is For the query column.
  • the query column is similar to the above partition key concept, and is a header of one or more columns in the data table.
  • Partition pruning refers to the process of removing unnecessary partitions and extracting the required partitions according to the query columns and query conditions in the from partition table and the where clause in the query statement.
  • the partition table is T
  • T is partitioned according to c1
  • the query column is c1
  • the query condition is c1 ⁇ 200.
  • the partition pruning technique can be used to remove other partitions except T1 in the C1 ⁇ 200 partition, and extract c1 ⁇
  • the partition of 200 is the data in T that satisfies the query condition.
  • FIG. 1 is a schematic structural diagram of a database system cluster according to an embodiment of the present invention.
  • the database system cluster includes a host A and a plurality of standby machines B connected to the host, wherein a database system is running on both the host and the standby.
  • the database system running on the host is usually called the primary database system, and the database system running on each standby machine is called the standby database system.
  • the database system cluster of the embodiment of the present invention includes a hardware entity and a software environment.
  • the hardware entity includes a host A and a plurality of standby machines B;
  • the software environment includes a primary database system and a plurality of standby database systems.
  • the host refers to the following description of the structure of the host, the hardware of the host, and the processing method of the data table provided by the host according to the embodiment of the present invention. I will not repeat them here.
  • the standby device refer to the following description of the structure of the standby device, the hardware of the standby device, and the processing method of the data table provided by the embodiment of the present invention, which are not described herein.
  • the database system when the database system is running, the database system may be identified as a primary database system or a standby database system. Specifically, when a database system is in a state of "primary”, it indicates that the database system is the primary database system; when a database system is running, the state is "standby" When the state of ")" indicates that the database system is a standby database system. If a database system is the primary database system, it means that one or more standby database systems are connected to the primary database system; if a database system is a standby database system, it indicates that the standby database system is connected to the primary database system.
  • the primary database system (or host) and the standby database system (or standby machine) in the embodiment of the present invention are relative concepts, that is, the primary database system and the standby database system are not absolutely unchanged, but The embodiment of the present invention is not limited to the specific application requirements/scenarios/environmental changes.
  • database system 1 is the primary database system
  • database system 2 is the standby database system
  • database system 1 may be a standby database system
  • database system. 2 may be the primary database system.
  • the embodiment of the present invention provides a data table processing method, which can be applied to a host and a standby machine in a database system cluster, and the processing method is Can include:
  • the host acquires a first partition instruction and a second partition instruction.
  • the first partition instruction includes a first partition key
  • the second partition instruction includes a second partition key.
  • the first partition instruction is configured to partition the first data table on the host according to the first partition key
  • the second partition instruction is configured to partition the second data table on the standby device according to the second partition key.
  • the first data table and the second data table are the same, and the first partition key and the second partition key are different.
  • the first data table may include data of multiple services, and the data of each service may be understood as a column of data in the first data table, that is, a table in which each service can be understood as a column in the first data table. head.
  • the first partition key can be understood as one of a plurality of services, that is, the first partition key can be understood as a header of a column in the first data table; the first partition table is a partition table corresponding to the service.
  • the second data table, the second partition key, and the second partition table are similar to the first data table, the first partition key, and the first partition table, and are not described herein again.
  • An optional implementation manner is: in the processing method of the data table provided by the embodiment of the present invention, before S101, the processing method further includes:
  • the host acquires a first creation instruction and a second creation instruction, where the first creation instruction is used to create a first data table on the standby machine, and the second creation instruction is used to create a second data table on the standby machine;
  • the creation instruction creates a first data table on the host;
  • the host sends a second creation instruction to the standby machine, and the standby machine creates a second data table on the standby machine according to the second creation instruction.
  • the host may also acquire the first creation instruction, the first partition instruction, the second creation instruction, and the second partition instruction at the same time.
  • a possible implementation manner is that the host acquires the first instruction set and the second instruction set, where the first instruction set includes a first creation instruction and a first partition instruction, and the second instruction set includes the second creation instruction and the second partition. instruction.
  • the first creation instruction and the first partition instruction may be specifically expressed as:
  • the first creation instruction is:
  • the first partition instruction is:
  • the first partition key in the first partition instruction is c1 (ie, it can be understood that the first partition key is the header of the c1 column in the data table).
  • the first partition instruction is used to indicate that the first data table is partitioned according to the c1 column, for example, all the rows of the c1 column in the first data table whose value is less than 100 are divided into the first partition (represented by the above c1_p1) All the rows of the c1 column in the first data table having a value less than 200 are divided into a second partition (represented by the above c1_p2), and all the rows of the c1 column in the first data table having a value less than 300 are divided into a third partition ( It can be expressed by the above c1_p3).
  • the second creation instruction and the second partition instruction may be specifically expressed as:
  • the second creation instruction is:
  • the second partition instruction is:
  • the second partition key in the second partition instruction is c2 (ie, it can be understood that the second partition key is the header of the c2 column in the data table).
  • the above c1 column and the c2 column are two different columns in the data table, that is, the header of the c1 column and the header of the c2 column are different, and the header of the c1 column and the c2 are The headers of the columns represent different businesses.
  • the foregoing second partition instruction is used to indicate that the second data table is partitioned according to the c2 column, for example, all the rows whose value of the c2 column in the second data table is less than 1000 are divided into the first partition (represented by the above c2_p1) All the rows of the c2 column in the second data table with the value less than 2000 are divided into the second partition (represented by the above c2_p2), and all the rows of the c2 column in the second data table with the value less than 3000 are divided into the third partition (available The above c2_p3 represents), and all the lines whose value of the c2 column is less than 4000 are divided into a fourth partition (which can be represented by the above c2_p4) and the like.
  • the first partition represented by the above c2_p1
  • All the rows of the c2 column in the second data table with the value less than 2000 are divided into the second partition (represented by the above c2_p2)
  • the host partitions data of the first data table on the host according to the first partition key to obtain a first partition table.
  • Table 1 (which may be represented as T)
  • Table 1 may be expressed as:
  • Table 1 includes four types of business such as customer name, account number, age, and balance.
  • the host according to the first partition instruction listed above ie, the first listed above
  • the first partition key in the partition instruction satisfies the condition.
  • the first partition table obtained by partitioning the data in Table 1 according to the account number can be expressed as Table 2 (since the data in Table 2 is the same as Table 1, so Table 2 can still be Expressed as T).
  • the first partition table obtained by the host according to the account partition of the table 1 may include three partitions, and the three partitions are respectively denoted as c1_p1 (account is less than 100), c1_p2 (account number Less than 200) and c1_p3 (the account number is less than 300), then c1_p1 includes three rows of data in Table 2 with rows 1, 2, and 4; c1_p2 includes five rows of data in Table 2 with rows 1-4 and 6; c1_p3 includes rows in Table 2. The number of eight rows of data is 1-8.
  • the host sends a second partition instruction to the standby machine.
  • the second partition instruction is used to trigger the standby machine to partition the data of the second data table according to the second partition key to obtain the second partition table.
  • the standby machine receives a second partition instruction sent by the host.
  • the standby machine partitions the data of the second data table on the standby machine according to the second partition key according to the second partition instruction to obtain a second partition table.
  • the second data table on the standby device may be pre-stored on the standby device, or may be sent to the standby device before the host performs the processing method of the data table provided by the embodiment of the present invention, or may be The host sends the second partition instruction to the standby machine when it sends the second partition instruction. It can be determined according to the actual use requirement, and is not limited by the embodiment of the present invention.
  • the second data table created by the fake device according to the second creation instruction is also the above table 1
  • the second partition key (for example, c2 in the second partition instruction listed above) is the balance in the above table 1, and the standby machine is based on the second partition instruction listed above (ie, the second partition in the second partition instruction listed above).
  • the condition that the key satisfies) the second partition table obtained by partitioning the data in Table 1 according to the balance can be expressed as Table 3 (since the data in Table 3 is the same as Table 1, so Table 3 can still be represented as T).
  • the second partition table obtained by the standby machine according to the balance partition of the table 1 may include four partitions, and the four partitions are respectively represented as c2_p1 (balance less than 1000), c2_p2 ( The balance is less than 2000), c2_p3 (balance less than 3000) and c2_p4 (balance less than 4000), then c2_p1 includes one row of data in row 1 of table 3; c2_p2 includes three rows of data in rows 1, 1, 2 and 5; c2_p3 It includes five rows of data in Table 3 with rows 1-3 and 5-6; c2_p4 includes eight rows of data in Table 3 with rows 1-8.
  • each of the foregoing Tables 2 and 3 may also be a small table, and the small tables may be physically partitioned, that is, physically stored in different storage spaces.
  • the above table 2 is a large table, the large table includes three small tables, and the three small tables correspond to three partitions included in the table 2.
  • the three small tables can be physically partitioned;
  • the above table 3 is also a Large table, the large table includes 4 small tables, which correspond to the four partitions included in Table 3, which can be physically partitioned and stored.
  • Tables 2 and 3 are a large table, that is, Tables 2 and 3 are exemplary examples of logical concepts in software execution.
  • the query column and the query condition in the query instruction that can be obtained for the host are Query the required data in the corresponding partition table.
  • a description of the query for the partition table will be described in detail in the following embodiments.
  • the processing method of the data table provided by the embodiment of the present invention because the first partition table can be obtained by partitioning the first data table according to the first partition key on the host, and the second partition key different from the first partition key is used on the standby machine. Partitioning the second data table that is identical to the first data table to obtain a second partition table, that is, partitioning the same data table according to different partition keys on the host and the standby machine to obtain different partition tables, and thus Compared with the processing method of the data table provided by the embodiment of the present invention, since both the host and the standby device do not need to store multiple identical partition tables, the number of partition tables stored in the host and the standby machine can be reduced, thereby saving the database system. The storage space of the physical machines (including the host and the standby) in the cluster, thereby improving the performance of data processing, that is, better management of the data.
  • the data table is partitioned to obtain the partition table by using the data table processing method provided by the embodiment of the present invention, if the partition table is queried by using the partition pruning technology, the data can be guaranteed.
  • the partitions in the partition table that satisfy the query conditions are accurately filtered out.
  • partition tables are respectively stored on different physical machines (for example, the first partition table obtained according to the first partition key partition is stored in the On the host, the second partition table obtained according to the second partition key partition is stored on the standby machine, etc., so that the redundant partition table is not stored on the host, thereby improving the system performance of the host.
  • the partition table different from the partition table stored on the host can be stored on the standby machine, when the query requirement is larger, the host load can be increased. In the case of the expansion of the standby machine to meet the query requirements, thereby improving the query capabilities of the database system cluster.
  • the processing method of the data table provided by the embodiment of the present invention may further include:
  • the host acquires a query instruction.
  • the query instruction includes a query column and a query condition, and the query column is the same as the first partition key.
  • the host executes a query instruction on the first partition table.
  • the query instruction may be input by the user through the input interface of the host, or may be sent by the network node to the host, and may be determined according to the actual application scenario, which is not limited by the embodiment of the present invention.
  • the query instruction can be used to query data in the first partition table that satisfies the query condition.
  • the query instruction can be used to query data of c1 less than 200 in the first partition table.
  • the query instruction can be used to query data of an account number less than 200 in the first partition table shown in Table 2, that is, five rows of data including rows 1-4 and 6 in Table 2.
  • the query instruction can also be understood that a partition with c1 ⁇ 200 is queried in the first partition table.
  • the host executing the query instruction on the first partition table may be understood as: the host queries the first partition table for data that satisfies the query condition. For example, based on the above Table 2, the host queries the first partition table for data having an account number less than 200 (i.e., c1_p2 described above, including five rows of data having rows 1-4 and 6 in Table 2).
  • the processing method of the data table provided by the embodiment of the present invention may further include:
  • the host acquires a query instruction.
  • the query instruction includes a query column and a query condition, and the query column is the same as the second partition key.
  • the host sends a query instruction to the standby machine.
  • the standby machine receives a query instruction sent by the host.
  • the standby machine executes the query instruction on the second partition table.
  • the query instruction can be used to query data in the second partition table that has c2 less than 2000.
  • the query instruction can be used to query data in the second partition table shown in Table 3 with a balance of less than 2000, that is, three rows of data including rows 1, 1, and 5 in Table 3.
  • a partition with c2 ⁇ 2000 is queried in the second partition table.
  • the standby machine executing the query instruction on the second partition table may be understood as: the standby machine queries the second partition table for the data that satisfies the query condition. For example, based on the above Table 3, the standby machine queries the second partition table for data having a balance of less than 2000 (i.e., c2_p2 as described above, including three rows of data having rows of 1, 2, and 5 in Table 3).
  • the host and the standby machine respectively obtain the corresponding partition table
  • the host receives the user input or the query instruction sent by a certain network node
  • the host first determines whether the query column in the query instruction is the same as the first partition key on the host or the second partition key on the standby machine. If the host determines that the query column is the same as the first partition key on the host, the host executes the query instruction on the first partition table. If the host determines that the query column is the same as the second partition key on the standby machine, the host sends the query instruction to the standby machine, and the standby machine executes the query instruction on the second partition table.
  • the query instruction is executed by the host by default; specifically, the host performs row by row on the data of the first partition table. Query to query the data in the first partition table that satisfies the query condition.
  • the partition table is usually used to query the partition table.
  • the partition pruning technique refer to the definition of the partition pruning technique before the embodiment, and details are not described herein again.
  • the query sequence included in the query instruction may be used to determine whether the query instruction is executed by the host or the standby machine, that is, which partition table obtained by the host and the standby machine is obtained according to the query table. Which of the same partition key partitions as the query column is executed by the query instruction. This can improve the query efficiency (only need to filter out the data satisfying the query conditions in the corresponding partition, without filtering the entire data table) while saving the storage space of the physical machine in the database system cluster (because it is not required on each physical machine) Store multiple identical partition tables, thus reducing the number of partition tables stored in each physical machine in the database system cluster).
  • the processing method of the data table provided by the embodiment of the present invention may further include:
  • the host acquires a query instruction.
  • the query instruction includes a first query column, a first query condition corresponding to the first query column, a second query column, and a second query condition corresponding to the second query column, where the first query column is the same as the first partition key
  • the second query column is the same as the second partition key.
  • the relationship between the first query condition and the second query condition is "and".
  • the query instruction is configured to query data in the first partition table that satisfies the first query condition and the second query condition.
  • the embodiment of the present invention provides an exemplary description by using a query instruction including two query columns and two query conditions as an example, for two or more query columns and two or more queries.
  • the specific implementation of the condition is related to two query columns and two query conditions The specific implementation is similar, and will not be described here.
  • the host executes the query instruction on the first partition table.
  • the host may first determine that the query instruction includes the first query column, the first query condition corresponding to the first query column, the second query column, and the second query condition corresponding to the second query column; And determining whether the first query column and the second query column are the same as the first partition key and the second partition key; if the host determines that the first query column is the same as the first partition key, and the second query column is the same as the second partition key, And the relationship between the first query condition and the second query condition is “AND”, and the host executes the query instruction on the first partition table.
  • the query instruction includes the same first query column as the first partition key on the host, and the second query column that is the same as the second partition key on the standby machine, and the host and the standby are respectively targeted.
  • the process of making the intersection between the corresponding query column and the query condition query is very complicated. Therefore, in order to reduce the query complexity, the host can directly execute the query instruction on the first partition table by default. Specifically, the host may query, in the first partition table, data that satisfies the first query condition, and then the host queries the data that satisfies the second query condition in the data that satisfies the first query condition; or the host may be in the first partition table. The data that meets the second query condition is queried, and then the host queries the data that satisfies the first query condition in the data that meets the second query condition, which is not limited by the embodiment of the present invention.
  • the query instruction is: select*from T where c1 ⁇ 200and c2 ⁇ 2000, because the query instruction includes the same first query column c1 as the first partition key on the host, and includes and the standby
  • the second partition key has the same second query column c2, and the relationship between the two query conditions (ie, c1 ⁇ 200 and c2 ⁇ 2000) is an AND relationship. Therefore, in order to reduce the query complexity, the host may directly
  • the partition table executes the query instruction to determine data of c1 ⁇ 200 and c2 ⁇ 2000 in the first partition table (for example, two rows of data having rows 1 and 2 in Table 2).
  • the processing method of the data table provided by the embodiment of the present invention may further include:
  • the host acquires a query instruction.
  • the query instruction includes a first query column, a first query condition corresponding to the first query column, a second query column, and a second query condition corresponding to the second query column, where the first query column is the same as the first partition key
  • the second query column is the same as the second partition key.
  • the relationship between the first query condition and the second query condition in S112 is “AND”; the relationship between the first query condition and the second query condition in S114 is “or”.
  • the query instruction in S112 is configured to query data in the first partition table that satisfies the first query condition and the second query condition;
  • the query instruction in S114 is configured to query data in the first partition table that satisfies the first query condition, and query second The data in the partition table that satisfies the second query condition.
  • the host splits the query instruction into a first query instruction and a second query instruction.
  • the first query instruction includes a first query column and a first query condition for querying, in the first partition table, data that satisfies the first query condition;
  • the second query instruction includes the second query column and the second query condition, The data satisfying the second query condition is queried in the second partition table.
  • the host executes a first query instruction on the first partition table.
  • the host sends a second query instruction to the standby machine.
  • the standby machine receives a second query instruction sent by the host.
  • the standby machine executes a second query instruction on the second partition table.
  • the embodiment of the present invention does not limit the execution order of S116 and S117. That is, the embodiment of the present invention may first execute S116 and then execute S117. Alternatively, S117 may be executed first, then S116 may be performed; and S116 and S117 may be simultaneously executed.
  • the host since the first query column in the first query instruction is the same as the first partition key of the first partition table on the host, the host may execute the first query instruction on the first partition table; Since the second query column in the second query instruction is the same as the second partition key of the second partition table on the standby machine, the second query instruction may be executed by the standby machine on the second partition table.
  • the query instruction is: select*from T where c1 ⁇ 200or c2 ⁇ 2000, because the query instruction includes the same first query column c1 as the first partition key on the host, and includes and the standby
  • the second partition key has the same second query column c2, and the two query conditions (ie, c1 ⁇ 200 and c2 ⁇ 2000) are in an "or" relationship, so the host can split the query instruction into the first query instruction.
  • the second query instruction two query instructions.
  • the first query instruction may be expressed as: select*from T where c1 ⁇ 200; the second query instruction may be represented as select*from T where c2 ⁇ 2000.
  • the host may specifically determine which physical machine (host or standby) is executed according to the relationship between the two query conditions.
  • the query instruction based on the partition table obtained by the processing method of the data table provided by the embodiment of the present invention, the query efficiency of querying the partition table can be improved to some extent.
  • the query instruction may further include a larger number of query columns.
  • the query flow executed by the host and the standby device can still adopt the method flow shown in FIG. 5 and FIG. 6 above.
  • the method flow shown in FIG. 5 is adopted, and the host executes a query instruction on the first partition table; if multiple query conditions are between “or” Relationship, the method flow shown in Figure 6 is used, and the query instruction is executed by the host and the standby machine (specifically, the first query instruction after the query instruction is split by the host is executed, and the query instruction is split by the standby machine.
  • Second query instruction Second query instruction).
  • the method flow shown in FIG. 5 and FIG. 6 may be specifically combined in the specific implementation, and the design is executed by the host.
  • the method flow shown in FIG. 5 is implemented by the standby machine by the method flow shown in FIG. 6.
  • the relationship between multiple query conditions is "and", or the relationship between multiple query conditions is "or".
  • the embodiment of the present invention is not described in detail in the case where there is an "or" relationship and an "or" relationship between the plurality of query conditions.
  • FIG. 3 if the query instruction includes a query condition, the host and the backup machine in the embodiment of the present invention are as shown in FIG. 3 or The method shown in FIG. 4 is executed. If the query instruction includes multiple query conditions, the host and the backup machine in the embodiment of the present invention are executed according to the method flow shown in FIG. 5 or FIG. 6 above.
  • the method for acquiring the first instruction set and the second instruction set by the host shown in the above S101 may specifically include:
  • the host acquires an instruction set, where the instruction set includes a create instruction, a first partition instruction, and a second partition instruction; the host generates a first instruction set according to the create instruction and the first partition instruction, and generates a second instruction set according to the create instruction and the second partition instruction. .
  • the instruction set may be input by the user through the input interface of the host, or may be sent by the network node to the host, and may be determined according to the actual application scenario, which is not limited in the embodiment of the present invention.
  • the instruction set can be expressed as:
  • the creation instruction in the above instruction set is:
  • the first partition instruction in the above instruction set is:
  • the second partition instruction in the above instruction set is:
  • the first partition instruction in the instruction set is completely equivalent to the partition instruction in the first instruction set, and the second partition instruction in the instruction set and the second partition instruction in the second partition instruction set are also It is completely equivalent. Since the instruction set includes both the first partition instruction and the second partition instruction, the first partition instruction in the instruction set further indicates that the partition is partitioned according to the first partition key c1 on the host (that is, the partition by range (c1) on primary ), and the instruction set The second partition instruction also indicates partitioning by partition (c2) on standby on the standby.
  • the first partition table may be synchronized between the host and the standby machine through the logical log.
  • the second partition table that is, the host and the standby machine can maintain the data in the first partition table and the data in the second partition table through the logical log.
  • the logical log synchronization between the host and the standby device can be understood as follows: after receiving the modification instruction, the host directly sends the modification instruction to the standby machine, so that the host and the backup machine respectively perform the modification instruction on the respective partition table. modify.
  • processing method of the data table provided by the embodiment of the present invention may further include:
  • the modification instruction is used to modify data in the data table (which may specifically include the first data table and the second data table). This modification includes insertion, deletion or change, and the like.
  • the data table (or partition table) on the host and the standby machine can be synchronized.
  • the host and the backup machine can create the same data table by using the above S101-S105; correspondingly, according to the method flow of the embodiment, after the host receives the modification instruction, the host will modify the host according to the modification instruction.
  • the first partition table is sent, and the host sends the modification instruction to the standby machine, so that the standby machine also modifies the second partition table on the standby machine according to the modification instruction, so that the data in the first partition table on the host can still be guaranteed. It is consistent with the data in the second partition table on the standby.
  • a physical log is used to synchronize the respective partition table between the host and the standby machine (using physical log synchronization can be understood as: the host sends the modified data to the standby machine, and the standby machine updates the data)
  • the host directly sends the modification instruction (the overhead of modifying the instruction is much smaller than the data overhead) to the standby machine, and the standby machine executes the modification instruction.
  • Modifying its partition table can save the synchronization overhead of synchronization between the first partition table on the host and the second partition table on the standby.
  • an embodiment of the present invention further provides a data table processing method, where the processing method is applied to a host in a database system cluster, where the database system cluster includes a host and a standby machine, and the processing method includes:
  • the host acquires a query instruction, where the query instruction includes a first query column and a first query condition corresponding to the first query column.
  • the first partition table is partitioning the data of the first data table on the host according to the first partition key owned.
  • the first data table may include data of a plurality of services, and the data of each service may be understood as a column of data in the first data table, that is, each service may be understood as a header of a column in the first data table.
  • the first partition key can be understood as one of a plurality of services, that is, the first partition key can be understood as a header of a column in the first data table; the first partition table is a partition table corresponding to the service.
  • the host before executing S201, creates a first data table on the host, and partitions the data of the first data table according to the first partition key to obtain a first partition table; the standby machine is created on the standby machine.
  • a second data table having the same data table, and partitioning the second data table according to the second partition key to obtain a second partition table.
  • the method for the host to create the first data table and obtain the first partition table, and the standby machine to create the second data table and obtain the second partition table may refer to the foregoing description of S101-S105 in the embodiment shown in FIG. Descriptions and examples, in order to avoid repetition, will not be repeated here.
  • the standby machine receives a query instruction sent by the host.
  • the standby machine executes the query instruction on the second partition table.
  • the second partition table is obtained by partitioning the data of the second data table on the standby machine according to the second partition key, the second data table is the same as the first data table on the host, and the second partition key and the first partition key are different.
  • the second data table, the second partition key, and the second partition table are respectively similar to the first data table, the first partition key, and the first partition table.
  • the relevant description of the table will not be described here.
  • the processing method of the data table provided by the embodiment of the present invention is that the first partition table is obtained by partitioning the data of the first data table on the host according to the first partition key, and the second partition table is on the standby machine and the first data.
  • the data of the second data table of the same table is obtained according to the second partition key partition. Therefore, when the first query column in the query instruction acquired by the host is the same as the first partition key, the host may perform the first partition table on the first partition table. When the first query column in the query command acquired by the host is the same as the second partition key, the host may send the query instruction to the standby machine, and the standby machine executes the query instruction on the second partition table.
  • the data table processing method provided by the embodiment of the present invention is compared with the prior art, because the same data table can be partitioned by different partition keys on the host and the standby machine to obtain different partition tables.
  • the machine does not need to store multiple identical partition tables, so the number of partition tables stored in the host and standby can be reduced, thereby saving the database system cluster.
  • the storage space of the physical machine including the host and the standby machine), thereby improving the performance of data processing, that is, better management of the data.
  • the query instruction further includes a second query column and a second query condition
  • the second query column is The second partition key of the second partition table is the same, and the first query condition and the second query condition are in an AND relationship
  • the query instruction is further used to query data in the first partition table that satisfies the second query condition, and second.
  • the partition table is obtained by partitioning the data of the second data table on the standby machine according to the second partition key.
  • the second data table is the same as the first data table, and the second partition key is different from the first partition key.
  • the query instruction further includes the second query column and the second query condition
  • the second query column is the same as the second partition key
  • the first query condition and the second query condition are “AND”
  • the query instruction further includes a second query column and a second query condition
  • the second query column is The second partition key of the second partition table is the same, and the first query condition and the second query condition are in an "or" relationship
  • the query instruction is further used to query the data in the second partition table that satisfies the second query condition, and the combination diagram 7.
  • the processing method of the data table provided by the embodiment of the present invention may further include:
  • the host splits the query instruction into a first query instruction and a second query instruction.
  • the first query instruction includes a first query column and a first query condition
  • the second query instruction includes a second query column and a second query condition
  • the second partition table is the second data of the second data table on the standby machine according to the second The partitioned key partition is obtained, the second data table is the same as the first data table on the host, and the second partition key is different from the first partition key.
  • the host sends a second query instruction to the standby machine.
  • the standby machine executes a second query instruction on the second partition table.
  • S202a may specifically include S202a:
  • the host executes a first query instruction on the first partition table.
  • the query instruction further includes the second query column and the second query condition
  • the second query column is the same as the second partition key
  • the first query condition and the second query condition are “or”
  • the host may specifically determine which physical machine (host or standby) is executed according to the relationship between the two query conditions.
  • the query instruction based on the partition table obtained by the processing method of the data table provided by the embodiment of the present invention, the query efficiency of querying the partition table can be improved to some extent.
  • an embodiment of the present invention provides a physical machine, which is a database system set.
  • the host in the cluster, the database system cluster includes the host and the standby, and the host includes:
  • the obtaining unit 10 is configured to obtain a first partition instruction including a first partition key, the second partition instruction includes a second partition key, and the second partition key is different from the first partition key; the execution unit 11.
  • the data of the first data table on the host is partitioned according to the first partition key to obtain a first partition table according to the first partition instruction acquired by the obtaining unit 10, and the sending unit 12 is configured to send and obtain the data to the standby machine.
  • the second partition instruction obtained by the unit 10 is configured to trigger the standby machine to partition the data of the second data table on the standby machine according to the second partition key to obtain the second partition table, the second data table and the first data.
  • the table is the same.
  • the obtaining unit 10 is further configured to obtain a query instruction, where the query instruction includes a query column and a query condition, where the query column is the same as the first partition key, and the query instruction is configured to query the first partition table to satisfy the query condition.
  • the execution unit 11 is further configured to execute the 1 query instruction acquired by the obtaining unit 10 on the first partition table.
  • the obtaining unit 10 is further configured to obtain a query instruction, where the query instruction includes a query column and a query condition, the query column is the same as the second partition key, and the query instruction is configured to query the second partition table to satisfy the query condition.
  • the sending unit 12 is further configured to send the query instruction acquired by the obtaining unit 10 to the standby machine, so that the standby machine executes the query instruction on the second partition table.
  • the obtaining unit 10 is further configured to obtain a query instruction, where the query instruction includes a first query column, a first query condition corresponding to the first query column, a second query column, and a second corresponding to the second query column.
  • the query condition is that the first query column is the same as the first partition key, the second query column is the same as the second partition key, and the relationship between the first query condition and the second query condition is “and”, and the query instruction is used for querying
  • the data that satisfies the first query condition and the second query condition in a partition table; the execution unit 11 is further configured to execute the query instruction acquired by the obtaining unit 10 on the first partition table.
  • the obtaining unit 10 is further configured to obtain a query instruction, where the query instruction includes a first query column, a first query condition corresponding to the first query column, a second query column, and a second corresponding to the second query column.
  • the query condition is that the first query column is the same as the first partition key, the second query column is the same as the second partition key, and the first query condition and the second query condition are in an "or" relationship, and the query instruction is used for the query.
  • the execution unit 11 is further configured to split the query instruction acquired by the obtaining unit 10 into a first query instruction and a second query instruction, where the first query instruction includes a first query column and a first query condition, and the second query instruction includes Querying the column and the second query condition; and executing the first query instruction on the first partition table; the sending unit 12 is further configured to send, to the standby machine, the second query instruction after the splitting of the execution unit 11 to make the standby pair
  • the second partition table executes the second query instruction.
  • the obtaining unit 10 and the executing unit 11 may be implemented by one or more processors; the sending unit 12 may be implemented by an interface circuit.
  • the sending unit 12 may be an interface circuit on a physical machine (and may also include a corresponding software interface if necessary).
  • the physical machine provided by the embodiment of the present invention is a host in a database system cluster.
  • the first partition table can be obtained by partitioning the first data table on the host according to the first partition key on the host, and the first partition key is pressed on the standby machine.
  • Different second partition keys the same second number on the standby machine as the first data table
  • the second partition table is obtained, that is, the same data table can be partitioned according to different partition keys on the host and the standby machine to obtain different partition tables, so that the data provided by the embodiment of the present invention is compared with the prior art.
  • an embodiment of the present invention provides a physical machine, which is a standby machine in a database system cluster.
  • the database system cluster includes a host and a standby machine, and the standby machine includes:
  • the receiving unit 20 is configured to receive a partitioning instruction sent by the host, where the partitioning instruction includes a partitioning key, and the executing unit 21 is configured to: according to the partitioning instruction received by the receiving unit 20, press the partitioning key on the data of the second data table on the standby machine. Partition to get the partition table, the second data table is the same as the first data table on the host.
  • the first data table is partitioned according to a partition key different from the partition key.
  • the partition key of the host partitioning the first data table is referred to as a first partition key
  • the partition table obtained by the host after partitioning the first data table is referred to as a first partition table
  • the partition key of the standby machine for partitioning the second data table For the second partition key, the partition table obtained by the standby machine after partitioning the second data table is referred to as a second partition table.
  • the receiving unit 20 is further configured to receive a query instruction sent by the host, where the query instruction includes a query column and a query condition, the query column is the same as the partition key, and the query instruction is configured to query the partition table to satisfy the query.
  • the data of the condition; the execution unit 21 is further configured to execute the query instruction received by the receiving unit 20 on the partition table.
  • the foregoing execution unit 21 may be implemented by one or more processors; the receiving unit 20 may be implemented by an interface circuit.
  • the receiving unit 20 may be an interface circuit on a physical machine (and may also include a corresponding software interface if necessary).
  • the physical machine provided by the embodiment of the present invention is a standby machine in the database system cluster, and the second partition key different from the first partition key of the first data table partitioned on the host machine may be used on the standby machine, and the second partition key on the host
  • a second data table partition with the same data table to obtain a second partition table different from the first partition table on the host, that is, the same data table can be partitioned according to different partition keys on the host and the standby machine to obtain different
  • the partition table therefore, compared with the prior art, the data table processing method provided by the embodiment of the present invention can reduce the partitions stored in the host and the standby machine because neither the host nor the standby machine need to store multiple identical partition tables.
  • the number of tables can save the storage space of physical machines (including hosts and backup machines) in the database system cluster, thereby improving the performance of data processing, that is, better management of data.
  • an embodiment of the present invention provides a physical machine, where the physical machine is a host in a database system cluster, and the database system cluster includes a host and a standby machine, and the host includes:
  • the obtaining unit 30 is configured to obtain a query instruction, where the query instruction includes a first query column and a first query condition corresponding to the first query column, where the query instruction is used to query data in the partition table that satisfies the first query condition; 31.
  • the first query table acquires the query instruction acquired by the obtaining unit 30, where the first query column is the same as the first partition key of the first partition table, and the first partition table is the first on the host.
  • the data of the data table is obtained according to the partition of the first partition key; the sending unit 32 uses In the case that the first query column is the same as the second partition key of the second partition table, the query instruction acquired by the obtaining unit 30 is sent to the standby machine, so that the standby machine executes the query instruction on the second partition table, and the second The partition table is obtained by partitioning the data of the second data table on the standby machine according to the second partition key.
  • the second data table is the same as the first data table, and the second partition key is different from the first partition key.
  • the query instruction further includes a second query column and a second query condition, and the second query column and the second partition table
  • the second partitioning key is the same, and the relationship between the first query condition and the second query condition is "and".
  • the query instruction is further used to query data in the first partition table that satisfies the second query condition, and the second partition table is paired.
  • the data of the second data table on the machine is obtained according to the second partition key partition, the second data table is the same as the first data table, and the second partition key is different from the first partition key.
  • the query instruction further includes a second query column and a second query condition, and the second query column and the second partition table
  • the second partition key is the same, and the first query condition and the second query condition are in an "or" relationship, and the query instruction is further used to query the data in the second partition table that satisfies the second query condition.
  • the execution unit 31 is further configured to split the query instruction acquired by the obtaining unit 30 into a first query instruction and a second query instruction, where the first query instruction includes a first query column and a first query condition, and the second query instruction includes a second query instruction Querying the column and the second query condition, the second partition table is obtained by partitioning the data of the second data table on the standby machine according to the second partition key, the second data table is the same as the first data table, and the second partition key is the first
  • the sending unit 32 is further configured to send, to the standby machine, the second query instruction after the splitting of the execution unit 31, so that the standby machine executes the second query instruction on the second partition table; and the executing unit 31 is specifically configured to The first partition table executes the first query instruction.
  • the obtaining unit 30 and the executing unit 31 may be implemented by one or more processors; the sending unit 32 may be implemented by an interface circuit.
  • the sending unit 32 may specifically be an interface circuit on a physical machine (and may also include a corresponding software interface if necessary).
  • the physical machine provided by the embodiment of the present invention is a host in a database system cluster, because the first partition table is obtained by partitioning the data of the first data table on the host according to the first partition key, and the second partition table is on the standby machine.
  • the data of the second data table that is the same as the first data table is obtained according to the second partition key partition. Therefore, when the first query column in the query instruction acquired by the host is the same as the first partition key, the host may The partition table executes the query instruction.
  • the host may send the query instruction to the standby machine, and the standby machine executes the query on the second partition table. instruction.
  • an embodiment of the present invention provides a physical machine, which is a standby machine in a database system cluster.
  • the database system cluster includes a host and a standby machine, and the standby machine includes:
  • the receiving unit 20 is configured to receive a query instruction sent by the host, where the query instruction includes a query column and a query condition, where the query column is the same as a partition key of the partition table, and the query instruction is configured to query data in the partition table that satisfies the query condition.
  • the partition table is obtained by partitioning the data of the second data table on the standby machine according to the partition key, the second data table is the same as the first data table on the host; and the executing unit 21 is configured to execute the receiving unit on the partition table. 20 received the query instruction.
  • the foregoing execution unit 21 may be implemented by one or more processors; the receiving unit 20 may be implemented by an interface circuit.
  • the receiving unit 20 may be an interface circuit on a physical machine (and may also include a corresponding software interface if necessary).
  • the physical machine provided by the embodiment of the present invention is a standby machine in a database system cluster. Since the partition table is obtained by partitioning the data of the second data table that is the same as the first data table on the host machine according to the partition key, When the query column in the query instruction acquired by the host is the same as the partition key, the host sends the query instruction to the standby machine, and the standby machine executes the query instruction on the partition table.
  • the processing method of the data table provided by the embodiment of the present invention can reduce the number of partition tables stored in the standby machine because the standby machine does not need to store multiple partition tables that are the same as the partition table stored by the host. Therefore, the storage space of the standby machine in the database system cluster can be saved, thereby improving the performance of data processing, that is, the data management can be better realized.
  • an embodiment of the present invention provides a physical machine including a processor 40, an interface circuit 41, a memory 42, and a system bus 43.
  • the obtaining unit 10 and the executing unit 11 shown in FIG. 9 may pass one or more of the foregoing.
  • the processor 40 shown in FIG. 12 is implemented; the above-described transmitting unit 12 shown in FIG. 9 can be realized by the interface circuit 41 shown in FIG.
  • the execution unit 21 shown in FIG. 10 may pass through one or more of FIG.
  • the illustrated processor 40 is implemented; the receiving unit 20 shown in FIG. 10 described above can be implemented by the interface circuit 41 as shown in FIG.
  • the obtaining unit 30 and the executing unit 31 shown in FIG. 11 may pass one or more of the foregoing.
  • the processor 40 shown in FIG. 12 is implemented; the above-described transmitting unit 32 shown in FIG. 11 can be realized by the interface circuit 41 shown in FIG.
  • the execution unit 21 shown in FIG. 10 may be configured by one or more of FIG.
  • the illustrated processor 40 is implemented; the receiving unit 20 shown in FIG. 10 described above can be implemented by the interface circuit 41 as shown in FIG.
  • the processor performs a processing method of the data table as shown in any one of FIGS. 2 to 6.
  • the physical machine shown in FIG. 12 performs a processing method of the data table as shown in any one of FIGS. 7 to 8.
  • the processing method of the data table shown in any one of FIG. 2 to FIG. 6 and any one of FIG. 7 to FIG. 8 refer to the related description in the foregoing embodiment. To avoid repetition, details are not described herein again.
  • the processor 40 can be implemented by one or more processors, and FIG. 12 is exemplarily illustrated by taking only one processor as an example.
  • the processor 40 can be a central processing unit (CPU).
  • the processor 40 can also be other general purpose processors, digital signal processing (DSP), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or Other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc.
  • the general purpose processor may be a microprocessor or the processor or any conventional processor or the like.
  • the interface circuit 41 may specifically be a communication interface on a physical machine.
  • the communication interface can be a wireless communication interface.
  • the wireless communication interface may be a wireless module of a physical machine or the like.
  • the processor 40 transmits and receives data to and from other devices, such as other physical devices, through the interface circuit 41.
  • the memory 42 may include a volatile memory such as a random-access memory (RAM); the memory 42 may also include a non-volatile memory such as a read-only memory (read) -only memory, ROM), flash memory, hard disk drive (HDD) or solid-state drive (SSD); the memory 42 may also include a combination of the above types of memories.
  • RAM random-access memory
  • ROM read-only memory
  • HDD hard disk drive
  • SSD solid-state drive
  • Memory 42 can include an underlying storage medium and memory.
  • the memory is coupled to the underlying storage medium for use as a cache for the underlying storage medium.
  • System bus 43 may include a data bus, a power bus, a control bus, and a signal status bus. For the sake of clarity in the present embodiment, various buses are illustrated as the system bus 43 in FIG.
  • the embodiment further provides a readable storage medium, where the readable storage medium includes computer execution instructions, when the physical machine runs, the processor of the physical machine executes the computer to execute instructions, so that the physical machine executes the present invention.
  • a method for processing a data table as shown in any one of FIGS. 2 to 6 or any one of FIGS. 7 to 8 is provided by the embodiment.
  • the readable storage medium in this embodiment may be the memory 42 shown in FIG. 12 above.
  • the physical machine provided by the embodiment of the present invention is a host or a standby machine in a database system cluster, and is applied to the processing method of the data table shown in any one of the foregoing FIG. 2 to FIG. 6, because the first partition key can be used on the host. Partitioning the first data table on the host to obtain the first partition table, and on the standby machine, according to the second partition key different from the first partition key, partitioning the second data table with the same data table as the first data table on the standby machine to obtain the second partition.
  • the table that is, the same data table can be partitioned by different partition keys on the host and the standby to obtain a different partition table. Therefore, compared with the prior art, the data table processing method provided by the embodiment of the present invention is due to the host.
  • Both the standby and the standby do not need to store multiple identical partition tables, so the number of partitioned tables stored in the host and the standby can be reduced, thereby saving storage space of physical machines (including hosts and standbys) in the database system cluster. Improve the performance of data processing, that is, Better management of the data.
  • the physical machine provided by the embodiment of the present invention is a host or a standby machine in a database system cluster, and is applied to the processing method of the data table shown in any one of the foregoing FIG. 7 to FIG. 8, because the first partition table is on the host.
  • the data of the first data table is obtained according to the first partition key partition
  • the second partition table is obtained by partitioning the data of the second data table that is the same as the first data table on the standby machine according to the second partition key, so when the host obtains
  • the host may execute the query instruction on the first partition table, when the first query column in the query instruction acquired by the host is the same as the second partition key
  • the query instruction may be sent by the host to the standby machine, and the standby machine executes the query instruction on the second partition table.
  • the data table processing method provided by the embodiment of the present invention is compared with the prior art, because the same data table can be partitioned by different partition keys on the host and the standby machine to obtain different partition tables.
  • the machine does not need to store multiple identical partition tables, so the number of partition tables stored in the host and the standby can be reduced, thereby saving storage space of physical machines (including hosts and standbys) in the database system cluster, thereby improving data.
  • the performance of the processing that is, the management of the data can be better realized.
  • the disclosed system, apparatus, and method may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of the modules or units is only a logical function division.
  • there may be another division manner for example, multiple units or components may be used. Combinations can be integrated into another system, or some features can be ignored or not executed.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in an electrical, mechanical or other form.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
  • the integrated unit if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable storage medium.
  • the storage medium includes instructions for causing a computer device (which may be a personal computer, server, or network device, etc.) or processor to perform all or part of the steps of the methods described in various embodiments of the present invention.
  • the foregoing storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a ROM, a RAM, a magnetic disk, or an optical disk.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Computing Systems (AREA)
  • Computational Linguistics (AREA)
  • Quality & Reliability (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种数据表的处理方法、装置及系统,涉及计算机技术领域,能够节省数据库系统集群中的物理机的存储空间,从而提升数据处理的性能。该处理方法包括:主机获取第一分区指令和第二分区指令,第一分区指令包括第一分区键,第二分区指令包括第二分区键(S101),第二分区键与第一分区键不同;主机根据第一分区指令,对主机上的第一数据表的数据按照第一分区键分区,以得到第一分区表(S102);主机向备机发送第二分区指令(S103),第二分区指令用于触发备机对备机上的第二数据表的数据按照第二分区键分区,以得到第二分区表(S105),第二数据表与第一数据表相同。

Description

一种数据表的处理方法、装置及系统
本申请要求于2016年05月31日提交中国专利局、申请号为201610379416.8、发明名称为“一种数据表的处理方法、装置及系统”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机技术领域,尤其涉及一种数据表的处理方法、装置及系统。
背景技术
分区技术是数据库系统中常用的一种技术,其是指按照分区键将数据表中满足不同条件的行或列划分为不同的区域,即将数据表中的数据划分为多个有一定共性的更小的数据区域,这些数据区域在逻辑上属于同一个表空间(即同一张数据表),而在物理上则是相互独立的数据。其中,经过划分的数据表可称为分区表。在对分区表进行查询时,为了提高查询效率,通常采用分区剪枝技术,即按照查询列的条件筛选出需要的分区,而采用分区剪枝技术时,查询指令中的where子语句指定的查询列必须是分区键(用于指示一部分数据的属性,例如数据表中一列或多列的表头,或者数据表中一行或多行的表头),所以若要采用分区剪枝技术,则需保证待查询的分区表的分区键与查询列相同。
目前,某个物理机在创建数据表后,该物理机可通过对该数据表的数据按照不同的分区键分区,以得到不同的分区表。如此,当需要采用分区剪枝技术对该数据表中的数据进行查询时,该物理机可以直接在相应的分区表中进行查询,以提高查询效率。
然而,随着技术的发展,当前数据库系统需要维护的数据不断增加,在很多应用场景(如云计算,大数据等)中需维护的数据量的体量较大,物理机中存储的分区表的数量也越来越多,现有的分区表创建方式和管理方式,使得数据库系统中需要维护许多具有相同内容的分区表,冗余较大,浪费了物理机的存储空间,从而影响了数据处理的性能。
发明内容
本发明的实施例提供一种数据表的处理方法、装置及系统,能够节省数据库系统集群中的物理机的存储空间,从而提升数据处理的性能。
为达到上述目的,本发明的实施例采用如下技术方案:
第一方面,本发明实施例提供一种数据表的处理方法,该处理方法应用于数据库系统集群中的主机,数据库系统集群包括该主机和备机,该处理方法包括:主机获取第一分区指令和第二分区指令,第一分区指令包括第一分区键,第二分区指令包括与第一分区键不同的第二分区键;且主机根据第一分区指令,对主机上的第一数据表的数据按照第一分区键分区,以得到第一 分区表;以及主机向备机发送第二分区指令,第二分区指令用于触发备机对备机上与第一数据表相同的第二数据表的数据按照第二分区键分区,以得到第二分区表。
其中,上述第一数据表中可以包括多个业务的数据,且每个业务的数据可以理解为第一数据表中的一列数据,即每个业务可以理解为第一数据表中的一列的表头。如此,第一分区键可以理解为多个业务中的一个业务,即第一分区键可以理解为第一数据表中一列的表头;第一分区表为对应于该业务的分区表。第二数据表、第二分区键以及第二分区表分别与第一数据表、第一分区键以及第一分区表类似,此处不再赘述。
本发明实施例提供的数据表的处理方法,由于可以在主机上按照第一分区键对主机上的第一数据表分区得到第一分区表,在备机上按照与第一分区键不同的第二分区键,对备机上与第一数据表相同的第二数据表分区得到第二分区表,即可以在主机和备机上对相同的数据表按照不同的分区键分区,以得到不同的分区表,因此与现有技术相比,本发明实施例提供的数据表的处理方法,由于主机和备机无需存储多个相同的分区表,因此可以减少主机和备机中存储的分区表的数量,从而能够节省数据库系统集群中的物理机(包括主机和备机)的存储空间,进而提升数据处理的性能,即能够更好地实现对数据的管理。
可选的,本发明实施例中,该处理方法还包括:主机获取用于创建第一数据表的第一创建指令和用于创建第二数据表的第二创建指令;且主机根据第一创建指令,在主机上创建第一数据表;以及主机向备机发送第二创建指令,用于触发备机在备机上创建第二数据表。
可选的,本发明实施例中,第一创建指令、第二创建指令、第一分区指令和第二分区指令均可以包含在一个指令集中。
可选的,在第一种可能的实现方式中,该处理方法还包括:主机获取包括查询列和查询条件的查询指令,该查询列与第一分区键相同,该查询指令用于查询第一分区表中满足该查询条件的数据;主机对第一分区表执行该查询指令。
可选的,在第二种可能的实现方式中,该处理方法还包括:主机获取包括查询列和查询条件的查询指令,该查询列与第二分区键相同,该查询指令用于查询第二分区表中满足该查询条件的数据;主机向备机发送该查询指令,以使备机对第二分区表执行该查询指令。
本发明实施例中,主机上的第一数据表按照第一分区键分区,备机上的第二数据表按照第二分区键分区,当需要对数据表中某个业务的数据进行查询时,如果主机确定查询指令中的查询列与第一分区键相同,则由主机对第一分区表执行该查询指令,即在主机上的第一分区表中查询满足该查询条件的数据;如果主机确定该查询列与第一分区键和第二分区键均不相同,则由主机对第一分区表执行该查询指令,即在主机上的第一分区表中查询满足该查询条件的数据;如果主机确定该查询列与第二分区键相同,则主机将该查 询指令发送给备机,由备机对第二分区表执行该查询指令,即在备机上的第二分区表中查询满足该查询条件的数据。
本发明实施例中,为了提高对业务的数据进行查询时的查询效率,在查询过程中可采用分区剪枝技术。所谓分区剪枝技术是指根据查询语句中的from分区表和where子句中的查询列的条件(即查询条件)去除不需要的分区,并提取出需要的分区的过程。例如,分区表为T1,T1按照c1进行分区,查询列的条件为c1<200,则采用分区剪枝技术可以去除T1中除c1<200分区外的其他分区,并提取出c1<200的分区,即为T1中满足查询条件的数据。
可选的,在第三种可能的实现方式中,该处理方法还包括:主机获取包括第一查询列、与第一查询列对应的第一查询条件、第二查询列和与第二查询列对应的第二查询条件的查询指令,第一查询列与第一分区键相同,第二查询列与第二分区键相同,第一查询条件和第二查询条件之间为“与”的关系,该查询指令用于查询第一分区表中满足第一查询条件和第二查询条件的数据;且主机对第一分区表执行该查询指令。
可选的,在第四种可能的实现方式中,该处理方法还包括:主机获取包括第一查询列、与第一查询列对应的第一查询条件、第二查询列和与第二查询列对应的第二查询条件的查询指令,第一查询列与第一分区键相同,第二查询列与第二分区键相同,第一查询条件和第二查询条件之间为“或”的关系,该查询指令用于查询第一分区表中满足第一查询条件的数据,以及查询第二分区表中满足第二查询条件的数据;且主机将该查询指令拆分为包括第一查询列和第一查询条件的第一查询指令以及包括第二查询列和第二查询条件的第二查询指令,以及主机对第一分区表执行第一查询指令,且主机向备机发送第二查询指令,以使备机对第二分区表执行第二查询指令。
本发明实施例中,当查询指令包括两个查询列和两个查询条件(实际使用中还可以是多个查询列和多个查询条件)时,主机可根据两个查询条件的关系具体确定由哪个物理机(主机或备机)执行该查询指令。从而基于采用本发明实施例提供的数据表的处理方法得到的分区表,可以在一定程度上提高对该分区表进行查询的查询效率。
可选的,本发明实施例中,该处理方法还包括:主机获取修改指令;且主机根据该修改指令对第一分区表进行修改;以及主机向备机发送该修改指令,用于触发备机对第二分区表进行修改。
本发明实施例中,与主机和备机之间采用物理日志同步各自的分区表的方法(采用物理日志同步可以理解为:主机将修改的数据发送给备机,由备机更新该数据)相比,主机和备机之间采用逻辑日志同步各自的分区表的方法,由于主机直接将修改指令(修改指令的开销远远小于数据的开销)发送给备机,由备机通过执行该修改指令修改其分区表,因此能够节省主机上的第一分区表和备机上的第二分区表进行同步的同步开销。
第二方面,本发明实施例提供一种数据表的处理方法,该处理方法应用于数据库系统集群中的备机,数据库系统集群包括主机和备机,该处理方法 包括:备机接收主机发送的包括分区键的分区指令;且备机根据该分区指令,对备机上的第二数据表的数据按照该分区键分区,以得到分区表,第二数据表与主机上的第一数据表相同,第一数据表按照与该分区键不同的分区键分区。其中,主机对第一数据表分区的分区键称为第一分区键,主机对第一数据表分区后得到的分区表称为第一分区表;备机对第二数据表分区的分区键称为第二分区键,备机对第二数据表分区后得到的分区表称为第二分区表。
本发明实施例提供的数据表的处理方法,由于可以在备机上按照与主机上对第一数据表分区的第一分区键不同的第二分区键,对与主机上的第一数据表相同的第二数据表分区,以得到与主机上的第一分区表不同的第二分区表,即可以在主机和备机上对相同的数据表按照不同的分区键分区,以得到不同的分区表,因此与现有技术相比,本发明实施例提供的数据表的处理方法,由于主机和备机均无需存储多个相同的分区表,因此可以减少主机和备机中存储的分区表的数量,从而能够节省数据库系统集群中的物理机(包括主机和备机)的存储空间,进而提升数据处理的性能,即能够更好地实现对数据的管理。
可选的,本发明实施例中,该处理方法还包括:备机接收主机发送的包括查询列和查询条件的查询指令,该查询列与该分区键相同,该查询指令用于查询备机上的分区表(即第二分区表)中满足该查询条件的数据;且备机对备机上的分区表执行该查询指令。
本发明实施例中,基于采用本发明实施例提供的数据表的处理方法得到的分区表,可以由不同的物理机(主机或备机)执行相应的查询指令,例如由备机执行包括与第二分区键相同的查询列的查询指令,可以在一定程度上提高查询效率。
可选的,本发明实施例中,该处理方法还包括:备机接收主机发送的修改指令;且备机根据该修改指令对备机上的分区表进行修改。
本发明实施例中,当主机接收到对主机上的分区表的修改指令之后,主机可采用逻辑日志同步的方法将该修改指令发送给备机,由备机根据该修改指令修改备机上的分区表,如此能够节省主机上的分区表和备机上的分区表进行同步的同步开销。
第三方面,本发明实施例提供一种数据表的处理方法,该处理方法应用于数据库系统集群中的主机,该数据库系统集群包括主机和备机,该处理方法包括:主机获取包括第一查询列和与第一查询列对应的第一查询条件的查询指令,该查询指令用于查询分区表中满足第一查询条件的数据;在第一查询列与第一分区表的第一分区键相同的情况下,主机对第一分区表执行该查询指令,第一分区表是对主机上的第一数据表的数据按照第一分区键分区得到的;在第一查询列与第二分区表的第二分区键相同的情况下,主机向备机发送查询指令,以使备机对第二分区表执行该查询指令,第二分区表是对备机上的第二数据表的数据按照第二分区键分区得到的,第二数据表与第一数据表相同,第二分区键与第一分区键不同。
本发明实施例提供的数据表的处理方法,由于第一分区表是对主机上的第一数据表的数据按照第一分区键分区得到的,且第二分区表是对备机上与第一数据表相同的第二数据表的数据按照第二分区键分区得到的,因此当主机获取的查询指令中的第一查询列与第一分区键相同时,可以由主机对该第一分区表执行该查询指令,当主机获取的查询指令中的第一查询列与第二分区键相同时,可以由主机向备机发送该查询指令,由备机对该第二分区表执行该查询指令。由于可以在主机和备机上对相同的数据表按照不同的分区键分区,以得到不同的分区表,因此与现有技术相比,本发明实施例提供的数据表的处理方法,由于主机和备机均无需存储多个相同的分区表,因此可以减少主机和备机中存储的分区表的数量,从而能够节省数据库系统集群中的物理机(包括主机和备机)的存储空间,进而提升数据处理的性能,即能够更好地实现对数据的管理。
可选的,在第一种可能的实现方式中,在第一查询列与第一分区表的第一分区键相同的情况下,查询指令还包括第二查询列和第二查询条件,第二查询列与第二分区表的第二分区键相同,第一查询条件和第二查询条件之间为“与”的关系,查询指令还用于查询第一分区表中满足第二查询条件的数据,第二分区表是对备机上的第二数据表的数据按照第二分区键分区得到的,第二数据表和第一数据表相同,第二分区键与第一分区键不同。
可选的,在第二种可能的实现方式中,在第一查询列与第一分区表的第一分区键相同的情况下,查询指令还包括第二查询列和第二查询条件,第二查询列与第二分区表的第二分区键相同,第一查询条件和第二查询条件之间为“或”的关系,查询指令还用于查询第二分区表中满足第二查询条件的数据,该处理方法还包括:主机将查询指令拆分为包括第一查询列和第一查询条件的第一查询指令以及包括第二查询列和第二查询条件的第二查询指令,第二分区表是对备机上的第二数据表的数据按照第二分区键分区得到的,第二数据表和第一数据表相同,第二分区键与第一分区键不同;且主机向备机发送第二查询指令,以使备机对第二分区表执行第二查询指令;
其中,上述主机对第一分区表执行查询指令的方法包括:主机对第一分区表执行第一查询指令。
本发明实施例中,当查询指令包括两个查询列和两个查询条件(实际使用中还可以是多个查询列和多个查询条件)时,主机可根据两个查询条件的关系具体确定由哪个物理机(主机或备机)执行该查询指令。从而基于采用本发明实施例提供的数据表的处理方法得到的分区表,可以在一定程度上提高对该分区表进行查询的查询效率。
第四方面,本发明实施例提供一种数据表的处理方法,该处理方法应用于数据库系统集群中的备机,该数据库系统集群包括主机和备机,该处理方法包括:备机接收主机发送的包括查询列和查询条件的查询指令,该查询列与分区表的分区键相同,该查询指令用于查询该分区表中满足该查询条件的数据,该分区表是对备机上的第二数据表的数据按照该分区键分区得到的, 第二数据表和主机上的第一数据表相同;且备机对该分区表执行该查询指令。
本发明实施例提供的数据表的处理方法,由于该分区表是对备机上与主机上的第一数据表相同的第二数据表的数据按照该分区键分区得到的,因此当主机获取的查询指令中的查询列与该分区键相同时,主机向备机发送该查询指令,由备机对该分区表执行该查询指令。与现有技术相比,本发明实施例提供的数据表的处理方法,由于备机无需存储多个与主机存储的分区表相同的分区表,因此可以减少备机中存储的分区表的数量,从而能够节省数据库系统集群中的备机的存储空间,进而提升数据处理的性能,即能够更好地实现对数据的管理。
第五方面,本发明实施例提供一种物理机,该物理机为数据库系统集群中的主机,该数据库系统集群包括主机和备机,该主机包括获取单元、执行单元和发送单元。
获取单元用于获取包括第一分区键的第一分区指令和包括第二分区键的第二分区指令,第二分区键与第一分区键不同;执行单元用于根据获取单元获取的第一分区指令,对主机上的第一数据表的数据按照第一分区键分区,以得到第一分区表;发送单元,用于向备机发送获取单元获取的第二分区指令,第二分区指令用于触发备机对备机上与第一数据表相同的第二数据表的数据按照第二分区键分区,以得到第二分区表。
本发明实施例提供的物理机为数据库系统集群中的主机,由于可以在主机上按照第一分区键对主机上的第一数据表分区得到第一分区表,在备机上按照与第一分区键不同的第二分区键,对备机上与第一数据表相同的第二数据表分区得到第二分区表,即可以在主机和备机上对相同的数据表按照不同的分区键分区,以得到不同的分区表,因此与现有技术相比,本发明实施例提供的数据表的处理方法,由于主机和备机均无需存储多个相同的分区表,因此可以减少主机和备机中存储的分区表的数量,从而能够节省数据库系统集群中的物理机(包括主机和备机)的存储空间,进而提升数据处理的性能,即能够更好地实现对数据的管理。
需要说明的是,本发明实施例提供的物理机包括但不限于上述第五方面中的获取单元、执行单元和发送单元,并且上述第五方面中的获取单元、执行单元和发送单元具有的功能包括但不限于上述描述的功能。该物理机可以包括用于执行上述第一方面以及第一方面的各种可选方式所述的数据表的处理方法的单元/模块,这些单元/模块是为了执行上述第一方面以及第一方面的各种可选方式所述的数据表的处理方法,而对物理机进行的逻辑上的划分。
上述第五方面各种可选方式的技术效果的描述具体可参见上述对第一方面各种相应可选方式的技术效果的相关描述,此处不再赘述。
第六方面,本发明实施例提供一种物理机,该物理机为数据库系统集群中的备机,该数据库系统集群包括主机和备机,该备机包括接收单元和执行单元。
接收单元用于接收主机发送的包括分区键的分区指令;执行单元用于根 据接收单元接收的分区指令,对备机上的第二数据表的数据按照分区键分区,以得到分区表,第二数据表与主机上的第一数据表相同,第一数据表按照与该分区键不同的分区键分区。其中,主机对第一数据表分区的分区键称为第一分区键,主机对第一数据表分区后得到的分区表称为第一分区表;备机对第二数据表分区的分区键称为第二分区键,备机对第二数据表分区后得到的分区表称为第二分区表。
本发明实施例提供的物理机为数据库系统集群中的备机,由于可以在备机上按照与主机上对第一数据表分区的第一分区键不同的第二分区键,对与主机上的第一数据表相同的第二数据表分区,以得到与主机上的第一分区表不同的第二分区表,即可以在主机和备机上对相同的数据表按照不同的分区键分区,以得到不同的分区表,因此与现有技术相比,本发明实施例提供的数据表的处理方法,由于主机和备机均无需存储多个相同的分区表,因此可以减少主机和备机中存储的分区表的数量,从而能够节省数据库系统集群中的物理机(包括主机和备机)的存储空间,进而提升数据处理的性能,即能够更好地实现对数据的管理。
需要说明的是,本发明实施例提供的物理机包括但不限于上述第六方面中的接收单元和执行单元,并且上述第六方面中的接收单元和执行单元具有的功能包括但不限于上述描述的功能。该物理机可以包括用于执行上述第二方面以及第二方面的各种可选方式所述的数据表的处理方法的单元/模块,这些单元/模块是为了执行上述第二方面以及第二方面的各种可选方式所述的数据表的处理方法,而对物理机进行的逻辑上的划分。
上述第六方面各种可选方式的技术效果的描述具体可参见上述对第二方面各种相应可选方式的技术效果的相关描述,此处不再赘述。
第七方面,本发明实施例提供一种物理机,该物理机为数据库系统集群中的主机,该数据库系统集群包括主机和备机,该主机包括获取单元、执行单元和发送单元。
获取单元用于获取包括第一查询列和与第一查询列对应的第一查询条件查询指令,该查询指令用于查询分区表中满足第一查询条件的数据;执行单元用于在第一查询列与第一分区表的第一分区键相同的情况下,对第一分区表执行获取单元获取的该查询指令,第一分区表是对主机上的第一数据表的数据按照第一分区键分区得到的;发送单元,用于在第一查询列与第二分区表的第二分区键相同的情况下,向备机发送获取单元获取的查询指令,以使备机对第二分区表执行该查询指令,第二分区表是对备机上的第二数据表的数据按照第二分区键分区得到的,第二数据表与第一数据表相同,第二分区键与第一分区键不同。
本发明实施例提供的物理机为数据库系统集群中的主机,由于第一分区表是对主机上的第一数据表的数据按照第一分区键分区得到的,且第二分区表是对备机上与第一数据表相同的第二数据表的数据按照第二分区键分区得到的,因此当主机获取的查询指令中的第一查询列与第一分区键相同时,可 以由主机对该第一分区表执行该查询指令,当主机获取的查询指令中的第一查询列与第二分区键相同时,可以由主机向备机发送该查询指令,由备机对该第二分区表执行该查询指令。由于可以在主机和备机上对相同的数据表按照不同的分区键分区,以得到不同的分区表,因此与现有技术相比,本发明实施例提供的数据表的处理方法,由于主机和备机均无需存储多个相同的分区表,因此可以减少主机和备机中存储的分区表的数量,从而能够节省数据库系统集群中的物理机(包括主机和备机)的存储空间,进而提升数据处理的性能,即能够更好地实现对数据的管理。
需要说明的是,本发明实施例提供的物理机包括但不限于上述第七方面中的获取单元和执行单元,并且上述第七方面中的获取单元和执行单元具有的功能包括但不限于上述描述的功能。该物理机可以包括用于执行上述第三方面以及第三方面的各种可选方式所述的数据表的处理方法的单元/模块,这些单元/模块是为了执行上述第三方面以及第三方面的各种可选方式所述的数据表的处理方法,而对物理机进行的逻辑上的划分。
上述第七方面各种可选方式的技术效果的描述具体可参见上述对第三方面各种相应可选方式的技术效果的相关描述,此处不再赘述。
第八方面,本发明实施例提供一种物理机,该物理机为数据库系统集群中的备机,该数据库系统集群包括主机和备机,该备机包括接收单元和执行单元。
接收单元用于接收主机发送的包括查询列和查询条件的查询指令,该查询列与分区表的分区键相同,该查询指令用于查询该分区表中满足该查询条件的数据,该分区表是对备机上的第二数据表的数据按照该分区键分区得到的,第二数据表和主机上的第一数据表相同;执行单元用于对该分区表执行接收单元接收的该查询指令。
本发明实施例提供的物理机为数据库系统集群中的备机,由于该分区表是对备机上与主机上的第一数据表相同的第二数据表的数据按照该分区键分区得到的,因此当主机获取的查询指令中的查询列与该分区键相同时,主机向备机发送该查询指令,由备机对该分区表执行该查询指令。与现有技术相比,本发明实施例提供的数据表的处理方法,由于备机无需存储多个与主机存储的分区表相同的分区表,因此可以减少备机中存储的分区表的数量,从而能够节省数据库系统集群中的备机的存储空间,进而提升数据处理的性能,即能够更好地实现对数据的管理。
需要说明的是,本发明实施例提供的物理机包括但不限于上述第八方面中的接收单元和执行单元,并且上述第八方面中的接收单元和执行单元具有的功能包括但不限于上述描述的功能。该物理机可以包括用于执行上述第四方面以及第四方面的各种可选方式所述的数据表的处理方法的单元/模块,这些单元/模块是为了执行上述第四方面以及第四方面的各种可选方式所述的数据表的处理方法,而对物理机进行的逻辑上的划分。
第九方面,本发明实施例提供一种物理机,该物理机为数据库系统集群 中的主机,该数据库系统集群包括主机和备机,该主机包括处理器、接口电路、存储器和系统总线。
存储器用于存储计算机执行指令,处理器、接口电路和存储器通过系统总线相互连接,当主机运行时,处理器执行存储器存储的计算机执行指令,以使主机执行上述第一方面或其任意一种可选方式所述的数据表的处理方法。
第十方面,本发明实施例提供一种可读存储介质,该可读存储介质包括计算机执行指令,当主机运行时,主机的处理器执行计算机执行指令,以使主机执行上述第一方面或其任意一种可选方式所述的数据表的处理方法。
上述第九方面和第十方面的技术效果的描述具体可参见上述对第一方面及其各种可选方式的技术效果的相关描述,此处不再赘述。
第十一方面,本发明实施例提供一种物理机,该物理机为数据库系统集群中的备机,该数据库系统集群包括主机和备机,该备机包括处理器、接口电路、存储器和系统总线。
存储器用于存储计算机执行指令,处理器、接口电路和存储器通过系统总线相互连接,当备机运行时,处理器执行存储器存储的计算机执行指令,以使备机执行上述第二方面或其任意一种可选方式所述的数据表的处理方法。
第十二方面,本发明实施例提供一种可读存储介质,可读存储介质包括计算机执行指令,当备机运行时,备机的处理器执行计算机执行指令,以使备机执行上述第二方面或其任意一种可选方式所述的数据表的处理方法。
上述第十一方面和第十二方面的技术效果的描述具体可参见上述对第二方面及其各种可选方式的技术效果的相关描述,此处不再赘述。
第十三方面,本发明实施例提供一种物理机,该物理机为数据库系统集群中的主机,该数据库系统集群包括主机和备机,该主机包括处理器、接口电路、存储器和系统总线。
存储器用于存储计算机执行指令,处理器、接口电路和存储器通过系统总线相互连接,当主机运行时,处理器执行存储器存储的计算机执行指令,以使主机执行上述第三方面或其任意一种可选方式所述的数据表的处理方法。
第十四方面,本发明实施例提供一种可读存储介质,该可读存储介质包括计算机执行指令,当主机运行时,主机的处理器执行计算机执行指令,以使主机执行上述第三方面或其任意一种可选方式所述的数据表的处理方法。
上述第十三方面和第十四方面的技术效果的描述具体可参见上述对第三方面及其各种可选方式的技术效果的相关描述,此处不再赘述。
第十五方面,本发明实施例提供一种物理机,该物理机为数据库系统集群中的备机,该数据库系统集群包括主机和备机,该备机包括处理器、接口电路、存储器和系统总线。
存储器用于存储计算机执行指令,处理器、接口电路和存储器通过系统总线相互连接,当备机运行时,处理器执行存储器存储的计算机执行指令,以使备机执行上述第四方面所述的数据表的处理方法。
第十六方面,本发明实施例提供一种可读存储介质,可读存储介质包括 计算机执行指令,当备机运行时,备机的处理器执行计算机执行指令,以使备机执行上述第四方面所述的数据表的处理方法。
上述第十五方面和第十六方面的技术效果的描述具体可参见上述对第四方面的技术效果的相关描述,此处不再赘述。
第十七方面,本发明实施例提供一种数据库系统集群,该数据库系统集群包括主机和至少一个备机。其中:
该主机为上述第五方面所述的物理机,该备机为上述第六方面所述的物理机;或者,该主机为上述第七方面所述的物理机,该备机为上述第八方面所述的物理机;或者,该主机为上述第九方面所述的物理机,该备机为上述第十一方面所述的物理机;或者,该主机为上述第十三方面所述的物理机,该备机为上述第十五方面所述的物理机。
第十七方面的技术效果的描述具体可以参见上述对相应方面的技术效果的相关描述,此处不再赘述。
附图说明
图1为本发明实施例提供的数据库系统集群的架构示意图;
图2为本发明实施例提供的一种数据表的处理方法的示意图一;
图3为本发明实施例提供的一种数据表的处理方法的示意图二;
图4为本发明实施例提供的一种数据表的处理方法的示意图三;
图5为本发明实施例提供的一种数据表的处理方法的示意图四;
图6为本发明实施例提供的一种数据表的处理方法的示意图五;
图7为本发明实施例提供的另一种数据表的处理方法的示意图一;
图8为本发明实施例提供的另一种数据表的处理方法的示意图二;
图9为本发明实施例提供的主机的结构示意图一;
图10为本发明实施例提供的备机的结构示意图一;
图11为本发明实施例提供的主机的结构示意图二;
图12为本发明实施例提供的物理机的硬件示意图。
具体实施方式
本文中字符“/”,一般表示前后关联对象是一种“或者”的关系。例如,A/B可以理解为A或者B。
本申请的说明书和权利要求书中的术语“第一”和“第二”等是用于区别不同的对象,而不是用于描述对象的特定顺序。例如,第一分区表和第二分区表等是用于区别不同的分区表,而不是用于描述分区表的特征顺序。
在本申请的描述中,除非另有说明,“多个”的含义是指两个或两个以上。例如,多个业务是指两个或两个以上业务。
此外,本申请的描述中所提到的术语“包括”和“具有”以及它们的任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括其他没有列出的步骤或单元,或可选地还包括对于这些过程、方法、产品或设备固有的其它步骤或单元。
以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、接口、技术之类的具体细节,以便透切理解本申请。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施例中也可以实现本申请。在其它情况中,省略对众所周知的装置、电路以及方法的详细说明,以免不必要的细节妨碍本申请的描述。
为了更加清楚地理解本发明实施例的各种实现方式,下面首先对本发明实施例中涉及的技术术语进行定义/说明。
分区技术:是指按照分区键将数据表划分为更小的片段,这些片段在逻辑上属于同一个表空间,而在物理上则是相互独立的数据,这些相互独立的数据形成若干个数据分区。
表空间:是指一个或多个数据表的集合。
数据表:是指包括多个业务的数据的表。该表包括多行和多列,每一列或者每一行对应一个业务。为了便于表述,本发明实施例中以每一列对应一个业务为例进行描述,应理解,在每一行对应一个业务的情况下,本申请所述的方案同样可以执行,具体方式不再赘述。
在每一列对应一个业务的情况下,每一列的表头可以理解为一个业务,每一列的数据可以理解为一个业务的数据。
分区键:是指对数据表进行分区的一个或多个列的表头,或者对数据表进行分区的一个或多个行的表头。为了便于表述,本发明实施例中以分区键是对数据表进行分区的一个列的表头为例进行描述,应理解,在分区键是对数据表进行分区的多个列、一个行或多个行的表头的情况下,本申请所述的方案同样可以执行,具体方式不再赘述。
应理解,在分区键对应列的表头的情况下,查询指令中包括的是查询列,相应的,在分区键对应行的表头的情况下,查询指令中的查询列也可以适应性地被称为查询行,本申请所述的方案同样可以执行,为了便于表述,本申请实施例以分区键为列的表头为例进行叙述,应理解,在分区键对应行的表头的情况下,本申请所述的方案同样可以执行,具体方式不再赘述。
指令集:是指包含多个指令的一个集合。
分区表:是指按照分区键分区后的数据表。
分区:是指按照分区键,将数据表中满足不同条件的行或者列划分为不同区域(也称分区)的过程。需要说明的是,该划分过程通常并不会丢弃数据表中除划分所使用的分区键所在的行或者列之外的其他行或者列。例如,假设数据表有5列,如果按照第3列的表头(即分区键)分区,那么分区后的数据表(或者每个分区)仍然包括5列,即对数据表分区后,每个分区中都包含数据表中原来包含的所有列。可以理解,按照某一列的表头对数据表分区,只是将数据表的所有行划分为不同的分区,而数据表中的所有列在每个分区中都存在。相应的,按照某一行的表头对数据表分区,只是将数据表的所有列划分为不同的分区,而数据表中的所有行在每个分区中都存在。
一种可选方式中,为了提高查询效率,可以在对数据表分区后进一步对 每个分区的数据分别进行排序,以使得每个分区的数据在物理上顺序存储。
另一种可选方式中,为了提高查询效率,也可以先对数据表中的数据进行排序,然后再进一步对排序后的数据表进行分区。例如,可以将分区键设置为聚集索引,使得该数据表中的数据均按照该聚集索引在物理上顺序存储,然后再按照分区键的分区条件将设置聚集索引后的数据表进行划分,以完成对数据表的分区。
需要说明的是,按照分区键对数据表进行分区后得到分区表,该分区表可以包括多个小表(每个小表即为一个分区),多个小表可以存储在同一个存储空间,也可以存储在不同的存储空间。但是无论多个小表如何存储,对于用户来说,多个小表在逻辑上仍然为一个大表。例如,本申请中的第一分区表和第二分区表在逻辑上为一个大表。
进一步地,本发明实施例中均以第一分区表和第二分区表为一个大表进行示例性的描述,即本发明实施例中第一分区表和第二分区表均为软件执行中的逻辑上的概念。实际中,第一分区表和第二分区表中的各个分区(即上述的小表)在物理上还可以分区存储,即在物理上存储在不同的存储空间。例如,假设第一分区表包括3个分区,每个分区即为一个小表,这3个小表可以分别存储在物理机的硬盘上的不同扇区中。
查询列:是指对数据表(或者分区表)进行查询的查询参数,示例性的,若对数据表进行查询的查询参数为c1(例如,查询c1满足某个条件的数据),则c1即为查询列。查询列与上述分区键的概念类似,都为数据表中一列或者多列的表头。
分区剪枝:是指根据查询语句中的from分区表和where子句中的查询列和查询条件去除不需要的分区,并提取出需要的分区的过程。例如,分区表为T,T按照c1进行分区,查询列为c1,查询条件为c1<200,则采用分区剪枝技术可以去除T中除c1<200分区外的其他分区,并提取出c1<200的分区,即为T中满足查询条件的数据。
本发明实施例提供的数据表的处理方法可以应用于数据库系统集群中。如图1所示,为本发明实施例提供的一种数据库系统集群的架构示意图。该数据库系统集群包括一个主机A和与该主机连接的若干个备机B,其中,主机和备机上均运行有数据库系统。为了更好地理解运行在不同物理机上的数据库系统,运行在主机上的数据库系统通常称为主数据库系统,运行在每个备机上的数据库系统称为备数据库系统。示例性的,如图1所示,本发明实施例的数据库系统集群包括硬件实体和软件环境。其中,硬件实体包括主机A和若干个备机B;软件环境包括主数据库系统和若干个备数据库系统。
本发明实施例提供的数据库系统集群中,对于主机的具体实现可以参见下述实施例中对主机的结构、主机的硬件以及主机执行的本发明实施例提供的数据表的处理方法的相关描述,此处不再赘述。对于备机的具体实现可以参见下述实施例中对备机的结构、备机的硬件以及备机执行的本发明实施例提供的数据表的处理方法的相关描述,此处不再赘述。
本发明实施例中,具体实现时,可以用数据库系统运行时所处的状态标识数据库系统为主数据库系统或者备数据库系统。具体的,当某个数据库系统运行时所处的状态为“主(primary)”的状态时,表示该数据库系统为主数据库系统;当某个数据库系统运行时所处的状态为“备(standby)”的状态时,表示该数据库系统为备数据库系统。如果某个数据库系统为主数据库系统,则表示还有一个或多个备数据库系统与该主数据库系统连接;如果某个数据库系统为备数据库系统,则表示该备数据库系统连接到主数据库系统。
本领域技术人员可以理解,本发明实施例中的主数据库系统(或者主机)和备数据库系统(或者备机)是相对概念,即主数据库系统和备数据库系统并非是绝对不变的,而是可以根据实际应用需求/场景/环境变化的,本发明实施例不作具体限定。示例性的,假设在一个场景中,数据库系统1为主数据库系统,数据库系统2为备数据库系统;当场景发生变化时,即在另一个场景中,数据库系统1可能为备数据库系统,数据库系统2可能为主数据库系统。
基于上述如图1所示的数据库系统集群,如图2所示,本发明实施例提供一种数据表的处理方法,该处理方法可以应用于数据库系统集群中的主机和备机,该处理方法可以包括:
S101、主机获取第一分区指令和第二分区指令,第一分区指令包括第一分区键,第二分区指令包括第二分区键。
上述第一分区指令用于对主机上的第一数据表按照第一分区键分区,第二分区指令用于对备机上的第二数据表按照第二分区键分区。第一数据表和第二数据表相同,且第一分区键和第二分区键不同。
本发明实施例中,上述主机上的第一数据表表示主机可以读取到的数据表,例如第一数据表可以是存储在主机的存储介质中的,也可以是存储在与该主机对应的存储服务器等存储设备上的,本发明实施例不作具体限定。上述备机上的第二数据表表示备机可以读取到的数据表,例如第二数据表可以是存储在备机的存储介质中的,也可以是主机发送给该备机的,还可以是存储在与该备机对应的存储服务器等存储设备上的,本发明实施例不作具体限定。
其中,上述第一数据表中可以包括多个业务的数据,且每个业务的数据可以理解为第一数据表中的一列数据,即每个业务可以理解为第一数据表中的一列的表头。如此,第一分区键可以理解为多个业务中的一个业务,即第一分区键可以理解为第一数据表中一列的表头;第一分区表为对应于该业务的分区表。第二数据表、第二分区键以及第二分区表分别与第一数据表、第一分区键以及第一分区表类似,此处不再赘述。
一种可选的实现方式是,本发明实施例提供的数据表的处理方法中,在S101之前,该处理方法还包括:
主机获取第一创建指令和第二创建指令,第一创建指令用于在主机上创建第一数据表,第二创建指令用于在备机上创建第二数据表;主机根据第一 创建指令在主机上创建第一数据表;主机向备机发送第二创建指令,由备机根据第二创建指令在备机上创建第二数据表。
可选的,本发明实施例中,主机也可以同时获取第一创建指令、第一分区指令、第二创建指令和第二分区指令。
具体的,一种可能的实现方式是主机获取第一指令集和第二指令集,第一指令集包括第一创建指令和第一分区指令,第二指令集包括第二创建指令和第二分区指令。
示例性的,本发明实施例中,第一创建指令和第一分区指令具体可以表示为:
create table T(c1int,c2int)
partition by range(c1)
(partition c1_p1values less than(100),
partition c1_p2values less than(200),
partition c1_p3values less than(300))。
其中,第一创建指令为:
create table T(c1int,c2int);
第一分区指令为:
partition by range(c1)
(partition c1_p1values less than(100),
partition c1_p2values less than(200),
partition c1_p3values less than(300));
上述第一分区指令中的第一分区键为c1(即可以理解为第一分区键为上述数据表中的c1列的表头)。
具体的,上述第一分区指令用于指示按照c1列对第一数据表进行分区,例如,将第一数据表中c1列的数值小于100的所有行分为第一分区(可用上述c1_p1表示),将第一数据表中c1列的数值小于200的所有行分为第二分区(可用上述c1_p2表示),以及将第一数据表中c1列的数值小于300的所有行分为第三分区(可用上述c1_p3表示)等。
示例性的,本发明实施例中,第二创建指令和第二分区指令具体可以表示为:
create table T(c1int,c2int)
partition by range(c2)
(partition c2_p1values less than(1000),
partition c2_p2values less than(2000),
partition c2_p3values less than(3000),
partition c2_p4values less than(4000))。
其中,第二创建指令为:
create table T(c1int,c2int);
第二分区指令为:
partition by range(c2)
(partition c2_p1values less than(1000),
partition c2_p2values less than(2000),
partition c2_p3values less than(3000),
partition c2_p4values less than(4000));
上述第二分区指令中的第二分区键为c2(即可以理解为第二分区键为上述数据表中的c2列的表头)。
由于第一分区键和第二分区键不同,因此上述c1列和c2列为数据表中不同的两列,即c1列的表头和c2列的表头不同,且c1列的表头和c2列的表头分别代表不同的业务。
具体的,上述第二分区指令用于指示按照c2列对第二数据表进行分区,例如,将第二数据表中c2列的数值小于1000的所有行分为第一分区(可用上述c2_p1表示),将第二数据表中c2列的数值小于2000的所有行分为第二分区(可用上述c2_p2表示),将第二数据表中c2列的数值小于3000的所有行分为第三分区(可用上述c2_p3表示),以及将c2列的数值小于4000的所有行分为第四分区(可用上述c2_p4表示)等。
S102、主机根据第一分区指令,对主机上的第一数据表的数据按照第一分区键分区,以得到第一分区表。
示例性的,本发明实施例中,假设主机根据第一创建指令创建的第一数据表为表1(可以表示为T),则表1可以表示为:
表1(T)
行数 客户姓名 账号 年龄(岁) 余额(元)
1 李XX 056 15 859
2 张XX 089 16 1236
3 徐XX 168 16 2568
4 王XX 076 20 3689
5 张XX 273 14 1569
6 张XX 105 18 2880
7 徐XX 289 25 3786
8 王XX 295 31 3900
其中,上述表1中每一列的表头即可表示一个业务。例如,表1中包括客户姓名、账号、年龄以及余额四个业务等。
本发明实施例中,假设第一分区键(例如为上述列举的第一分区指令中的c1)为上述表1中的账号,则主机根据上述列举的第一分区指令(即上述列举的第一分区指令中第一分区键满足的条件),按照账号对表1中的数据分区后得到的第一分区表可以表示为表2(由于表2中的数据与表1相同,因此表2仍然可以表示为T)。
表2(T)
行数 客户姓名 账号 年龄(岁) 余额(元)
1 李XX 056 15 859
4 王XX 076 20 3689
2 张XX 089 16 1236
6 张XX 105 18 2880
3 徐XX 168 16 2568
5 张XX 273 14 1569
7 徐XX 289 25 3786
8 王XX 295 31 3900
从表2可以看出,本发明实施例中,主机对表1按照账号分区后得到的第一分区表可以包括三个分区,假设三个分区分别表示为c1_p1(账号小于100)、c1_p2(账号小于200)和c1_p3(账号小于300),则c1_p1包括表2中行数为1、2和4的三行数据;c1_p2包括表2中行数为1-4和6的五行数据;c1_p3包括表2中行数为1-8的八行数据。
S103、主机向备机发送第二分区指令。
其中,第二分区指令用于触发备机对第二数据表的数据按照第二分区键分区,以得到第二分区表。
S104、备机接收主机发送的第二分区指令。
S105、备机根据第二分区指令,对备机上的第二数据表的数据按照第二分区键分区,以得到第二分区表。
本发明实施例中,上述备机上的第二数据表可以为预先存储在备机上的,也可以为主机在执行本发明实施例提供的数据表的处理方法之前发送给备机的,还可以为主机向备机发送第二分区指令时发送给备机的。具体可以根据实际使用需求确定,本发明实施例不作限定。
本发明实施例中,由于主机上的第一数据表和备机上的第二数据表相同,因此示例性的,假设备机根据第二创建指令创建的第二数据表也为上述表1,且第二分区键(例如为上述列举的第二分区指令中的c2)为上述表1中的余额,则备机根据上述列举的第二分区指令(即上述列举的第二分区指令中第二分区键满足的条件),按照余额对表1中的数据分区后得到的第二分区表可以表示为表3(由于表3中的数据与表1相同,因此表3仍然可以表示为T)。
表3(T)
行数 客户姓名 账号 年龄(岁) 余额(元)
1 李XX 056 15 859
2 张XX 089 16 1236
5 张XX 273 14 1569
3 徐XX 168 16 2568
6 张XX 105 18 2880
4 王XX 076 20 3689
7 徐XX 289 25 3786
8 王XX 295 31 3900
从表3可以看出,本发明实施例中,备机对表1按照余额分区后得到的第二分区表可以包括四个分区,假设四个分区分别表示为c2_p1(余额小于1000)、c2_p2(余额小于2000)、c2_p3(余额小于3000)和c2_p4(余额小于4000),则c2_p1包括表3中行数为1的一行数据;c2_p2包括表3中行数为1、2和5的三行数据;c2_p3包括表3中行数为1-3和5-6的五行数据;c2_p4包括表3中行数为1-8的八行数据。
具体实现中,上述表2和表3中的每个分区也可以单独为一个小表,这些小表可以在物理上分区存储,即在物理上存储在不同的存储空间。例如上述表2为一个大表,该大表包括3个小表,这3个小表对应表2包括的三个分区,这3个小表可以在物理上分区存储;上述表3也为一个大表,该大表包括4个小表,这4个小表对应表3包括的四个分区,这4个小表可以在物理上分区存储。本发明实施例中仅以表2和表3是一个大表,即表2和表3为软件执行中逻辑上的概念为例进行示例性的说明。
进一步地,本发明实施例提供的数据表的处理方法,主机和备机按照上述如图2所示的方法流程分别得到分区表之后,可以针对主机获取的查询指令中的查询列和查询条件在相应的分区表中查询所需的数据。对于对分区表进行查询的描述将在下述实施例中进行详细说明。
本发明实施例提供的数据表的处理方法,由于可以在主机上按照第一分区键对第一数据表分区得到第一分区表,在备机上按照与第一分区键不同的第二分区键,对与第一数据表相同的第二数据表分区得到第二分区表,即可以在主机和备机上对相同的数据表按照不同的分区键分区,以得到不同的分区表,因此与现有技术相比,本发明实施例提供的数据表的处理方法,由于主机和备机均无需存储多个相同的分区表,因此可以减少主机和备机中存储的分区表的数量,从而能够节省数据库系统集群中的物理机(包括主机和备机)的存储空间,进而提升数据处理的性能,即能够更好地实现对数据的管理。
进一步地,采用本发明实施例提供的数据表的处理方法对数据表进行分区得到分区表后,若采用分区剪枝技术对该分区表进行查询,则可以保证能 够准确地筛选出该分区表中满足查询条件的分区。
进一步地,采用本发明实施例提供的数据表的处理方法对数据表进行分区后,由于不同的分区表分别存储在不同的物理机上(例如按照第一分区键分区得到的第一分区表存储在主机上,按照第二分区键分区得到的第二分区表存储在备机上等),因此使得主机上不用存储冗余的分区表,从而能够提升主机的系统性能。
进一步地,采用本发明实施例提供的数据表的处理方法,由于可以在备机上存储与主机上存储的分区表不同的分区表,因此当查询需求越来越大时,可以在不增加主机负荷的情况下,通过扩展备机满足该查询需求,从而提升数据库系统集群的查询能力。
可选的,结合图2,如图3所示,在S105之后,本发明实施例提供的数据表的处理方法还可以包括:
S106、主机获取查询指令。
其中,查询指令包括查询列和查询条件,该查询列与第一分区键相同。
S107、主机对第一分区表执行查询指令。
其中,该查询指令可以为用户通过主机上的输入接口输入的,也可以是由某个网络节点向主机发送的,具体的可以根据实际应用场景确定,本发明实施例不作限定。该查询指令可用于查询第一分区表中满足查询条件的数据。
示例性的,假设查询指令为select*from T where c1<200,则该查询指令中的查询列为c1,查询条件为c1小于200。由于该查询列与第一分区键相同,则该查询指令可用于查询第一分区表中c1小于200的数据。例如,结合上述表1和表2,该查询指令可用于在表2所示的第一分区表中查询账号小于200的数据,即包括表2中行数为1-4和6的五行数据。同时,也可以理解为在第一分区表中查询出c1<200的分区。
具体的,主机对第一分区表执行查询指令可以理解为:主机在第一分区表中查询满足查询条件的数据。例如,基于上述表2,主机在第一分区表中查询账号小于200的数据(即上述所述的c1_p2,包括表2中行数为1-4和6的五行数据)等。
可选的,结合图2,如图4所示,在S105之后,本发明实施例提供的数据表的处理方法还可以包括:
S108、主机获取查询指令。
其中,查询指令包括查询列和查询条件,该查询列与第二分区键相同。
S109、主机向备机发送查询指令。
S110、备机接收主机发送的查询指令。
S111、备机对第二分区表执行该查询指令。
对于查询指令的描述具体可以参见上述如图3所示的实施例中对查询指令的相关描述,此处不再赘述。
示例性的,假设查询指令为select*from T where c2<2000,则该查询指令中的查询列为c2,查询条件为c2小于2000。由于该查询列与第二分区键 相同,则该查询指令可用于查询第二分区表中c2小于2000的数据。例如,结合上述表1和表3,该查询指令可用于在表3所示的第二分区表中查询余额小于2000的数据,即包括表3中行数为1、2和5的三行数据。同时,也可以理解为在第二分区表中查询出c2<2000的分区。
具体的,备机对第二分区表执行查询指令可以理解为:备机在第二分区表中查询满足查询条件的数据。例如,基于上述表3,备机在第二分区表中查询余额小于2000的数据(即上述所述的c2_p2,包括表3中行数为1、2和5的三行数据)等。
结合上述图3和图4,本发明实施例提供的数据表的处理方法中,在主机和备机分别得到相应的分区表之后,若主机接收到用户输入或某个网络节点发送的查询指令,则主机首先确定该查询指令中的查询列是否与主机上的第一分区键或备机上的第二分区键相同。如果主机确定该查询列与主机上的第一分区键相同,则主机对第一分区表执行该查询指令。如果主机确定该查询列与备机上的第二分区键相同,则主机将该查询指令发送给备机,由备机对第二分区表执行该查询指令。如果主机确定该查询列与主机上的第一分区键和备机上的第二分区键均不相同,则默认由主机执行该查询指令;具体的,主机通过对第一分区表的数据逐行进行查询,以查询出第一分区表中满足查询条件的数据。
进一步地,在对分区表进行查询时,为了提高查询效率,通常采用分区剪枝技术对分区表进行查询。对于分区剪枝技术的描述具体可参见实施例之前对分区剪枝技术的定义,此处不再赘述。
本发明实施例中,当需要对某个业务进行查询时,可以根据查询指令包括的查询列确定由主机或者备机执行该查询指令,即确定主机和备机中哪一个得到的分区表是按照与该查询列相同的分区键分区的就由哪一个执行该查询指令。如此能够在提高查询效率(只需在相应分区中筛选出满足查询条件的数据,无需对整个数据表进行筛选)的同时节省数据库系统集群中的物理机的存储空间(由于每个物理机上都无需存储多个相同的分区表,因此可以减少数据库系统集群中的每个物理机中存储的分区表的数量)。
可选的,结合图2,如图5所示,在S105之后,本发明实施例提供的数据表的处理方法还可以包括:
S112、主机获取查询指令。
其中,该查询指令包括第一查询列、与第一查询列对应的第一查询条件、第二查询列和与第二查询列对应的第二查询条件,第一查询列与第一分区键相同,第二查询列与第二分区键相同。第一查询条件和第二查询条件之间为“与”的关系。该查询指令用于查询第一分区表中满足第一查询条件和第二查询条件的数据。
为了便于理解本发明实施例的具体实现方式,本发明实施例以查询指令包括两个查询列和两个查询条件为例进行示例性的说明,对于两个以上的查询列和两个以上的查询条件的具体实现方式均与两个查询列和两个查询条件 的具体实现方式类似,此处不再赘述。
S113、主机对第一分区表执行该查询指令。
主机获取到查询指令后,首先主机可确定查询指令包括第一查询列,与第一查询列对应的第一查询条件、第二查询列以及与第二查询列对应的第二查询条件;其次主机再判断第一查询列和第二查询列是否与第一分区键和第二分区键相同;若主机确定第一查询列与第一分区键相同,且第二查询列与第二分区键相同,以及第一查询条件和第二查询条件之间为“与”的关系,则主机对第一分区表执行该查询指令。
本实施例中,由于该查询指令既包括与主机上的第一分区键相同的第一查询列,又包括与备机上的第二分区键相同的第二查询列,且主机和备机分别针对相应的查询列和查询条件查询后再做交集的过程非常复杂,因此为了降低查询复杂度,可以直接默认由主机对第一分区表执行该查询指令。具体的,主机可在第一分区表中查询满足第一查询条件的数据,然后主机再在满足第一查询条件的数据中查询满足第二查询条件的数据;或者主机可在第一分区表中查询满足第二查询条件的数据,然后主机再在满足第二查询条件的数据中查询满足第一查询条件的数据,本发明实施例不作限定。
示例性的,假设查询指令为:select*from T where c1<200and c2<2000,由于该查询指令中既包括与主机上的第一分区键相同的第一查询列c1,又包括与备机上的第二分区键相同的第二查询列c2,且两个查询条件(即c1<200和c2<2000)之间为“与”的关系,因此为了降低查询复杂度,可直接由主机对第一分区表执行该查询指令,以在第一分区表中确定出c1<200且c2<2000的数据(例如表2中行数为1和2的两行数据)。
可选的,结合图2,如图6所示,在S105之后,本发明实施例提供的数据表的处理方法还可以包括:
S114、主机获取查询指令。
其中,该查询指令包括第一查询列、与第一查询列对应的第一查询条件、第二查询列和与第二查询列对应的第二查询条件,第一查询列与第一分区键相同,第二查询列与第二分区键相同。对于S114的其他描述具体可参见上述如图5所示的实施例中对S112的相关描述,此处不再赘述。
S114与S112不同的地方在于:
S112中第一查询条件和第二查询条件之间为“与”的关系;S114中第一查询条件和第二查询条件之间为“或”的关系。且S112中查询指令用于查询第一分区表中满足第一查询条件和第二查询条件的数据;S114中查询指令用于查询第一分区表中满足第一查询条件的数据,以及查询第二分区表中满足第二查询条件的数据。
S115、主机将查询指令拆分为第一查询指令和第二查询指令。
其中,第一查询指令包括第一查询列和第一查询条件,用于在第一分区表中查询满足第一查询条件的数据;第二查询指令包括第二查询列和第二查询条件,用于在第二分区表中查询满足第二查询条件的数据。
S116、主机对第一分区表执行第一查询指令。
S117、主机向备机发送第二查询指令。
S118、备机接收主机发送的第二查询指令。
S119、备机对第二分区表执行第二查询指令。
需要说明的是,本发明实施例不限定S116和S117的执行顺序,即本发明实施例可以先执行S116,后执行S117;也可以先执行S117,后执行S116;还可以同时执行S116和S117。
本发明实施例中,由于第一查询指令中的第一查询列与主机上的第一分区表的第一分区键相同,所以可以由主机对第一分区表执行第一查询指令;相应的,由于第二查询指令中的第二查询列与备机上的第二分区表的第二分区键相同,所以可以由备机对第二分区表执行第二查询指令。
示例性的,假设查询指令为:select*from T where c1<200or c2<2000,由于该查询指令中既包括与主机上的第一分区键相同的第一查询列c1,又包括与备机上的第二分区键相同的第二查询列c2,且两个查询条件(即c1<200和c2<2000)之间为“或”的关系,因此主机可将该查询指令拆分为第一查询指令和第二查询指令两个查询指令。其中,第一查询指令可以表示为:select*from T where c1<200;第二查询指令可以表示为select*from T where c2<2000。
本发明实施例中,当查询指令包括两个查询条件(实际使用中还可以是多个查询条件)时,主机可根据两个查询条件的关系具体确定由哪个物理机(主机或备机)执行该查询指令。从而基于采用本发明实施例提供的数据表的处理方法得到的分区表,可以在一定程度上提高对该分区表进行查询的查询效率。
本发明实施例提供的数据表的处理方法中,上述查询指令还可以包括更多数量的查询列。具体的,当上述查询指令包括多个查询列时,主机和备机执行的查询流程仍然可以采用上述图5和图6所示的方法流程。例如,若多个查询条件之间为“与”的关系,则采用如图5所示的方法流程,由主机对第一分区表执行查询指令;若多个查询条件之间为“或”的关系,则采用如图6所示的方法流程,由主机和备机执行查询指令(具体的由主机执行将查询指令拆分后的第一查询指令,由备机执行将查询指令拆分后的第二查询指令)。当然,对于多个查询条件之间既有“与”的关系,又有“或”的关系的情况,在具体实现中可以具体结合如图5和图6所示的方法流程,设计由主机执行如图5所示的方法流程,由备机执行如图6所示的方法流程实现。由于在数据库系统的实际应用中,一般对数据表(或者分区表)查询时,均是多个查询条件之间为“与”的关系,或者多个查询条件之间为“或”的关系的情况,因此,对于多个查询条件之间既有“与”的关系,又有“或”的关系的情况,本发明实施例在此不再详述。
本领域技术人员可以理解,结合上述图3、图4、图5和图6可知,若查询指令包括一个查询条件,则本发明实施例中主机和备机按照上述如图3或 图4所示的方法流程执行;若查询指令包括多个查询条件,则本发明实施例中主机和备机按照上述如图5或图6所示的方法流程执行。
可选的,本发明实施例提供的数据表的处理方法中,上述S101中所示的主机获取第一指令集和第二指令集的方法具体可以包括:
主机获取指令集,指令集包括创建指令、第一分区指令和第二分区指令;主机根据创建指令和第一分区指令生成第一指令集,并根据创建指令和第二分区指令生成第二指令集。
其中,该指令集可以为用户通过主机上的输入接口输入的,也可以是由某个网络节点向主机发送的,具体的可以根据实际应用场景确定,本发明实施例不作限定。
示例性的,本发明实施例中,该指令集可以表示为:
create table T(c1int,c2int)
partition by range(c1)on primary
(partition c1_p1values less than(100),
partition c1_p2values less than(200),
partition c1_p3values less than(300))
partition by range(c2)on standby
(partition c2_p1values less than(1000),
partition c2_p2values less than(2000),
partition c2_p3values less than(3000),
partition c2_p4values less than(4000))。
其中,上述指令集中的创建指令为:
create table T(c1int,c2int);
上述指令集中的第一分区指令为:
partition by range(c1)on primary
(partition c1_p1values less than(100),
partition c1_p2values less than(200),
partition c1_p3values less than(300));
上述指令集中的第二分区指令为:
partition by range(c2)on standby
(partition c2_p1values less than(1000),
partition c2_p2values less than(2000),
partition c2_p3values less than(3000),
partition c2_p4values less than(4000))
需要说明的是,该指令集中的第一分区指令与上述第一指令集中的分区指令是完全等价的,且该指令集中的第二分区指令与上述第二分区指令集中的第二分区指令也是完全等价的。由于该指令集中既包括第一分区指令又包括第二分区指令,因此该指令集中的第一分区指令还指示了在主机上按照第一分区键c1分区(即上述partition by range(c1)on primary),且该指令集中 的第二分区指令还指示了在备机上按照第二分区键c2分区(partition by range(c2)on standby)。
对于第一指令集和第二指令集的描述具体可参见上述S101中对第一指令集和第二指令集的相关描述,此处不再赘述。
可选的,本发明实施例提供的数据表的处理方法中,在主机得到第一分区表,备机得到第二分区表之后,主机和备机之间还可以通过逻辑日志同步第一分区表和第二分区表,即主机和备机之间可以通过逻辑日志保持第一分区表中的数据和第二分区表中的数据一致。
具体的,主机和备机之间通过逻辑日志同步可以理解为:主机接收到修改指令后,主机直接将修改指令发送给备机,这样主机和备机分别通过执行修改指令对各自的分区表进行修改。
示例性的,本发明实施例提供的数据表的处理方法还可以包括:
主机接收修改指令;主机根据修改指令对第一分区表进行修改;主机向备机发送修改指令;备机接收主机发送的修改指令;备机根据修改指令对第二分区表进行修改。
其中,该修改指令用于对数据表(具体可以包括第一数据表和第二数据表)中的数据进行修改。该修改包括插入、删除或改变等。
采用本实施例的方法流程,可以保证主机和备机上的数据表(或者分区表)同步。本发明实施例中,采用上述S101-S105,主机和备机可以创建相同的数据表;相应的,采用本实施例的方法流程,由于主机接收到修改指令后,主机将根据该修改指令修改主机上的第一分区表,并且主机会将该修改指令发送给备机,使得备机也根据该修改指令修改备机上的第二分区表,因此仍然能够保证主机上的第一分区表中的数据和备机上的第二分区表中的数据保持一致。
本发明实施例中,与主机和备机之间采用物理日志同步各自的分区表的方法(采用物理日志同步可以理解为:主机将修改的数据发送给备机,由备机更新该数据)相比,主机和备机之间采用逻辑日志同步各自的分区表的方法,由于主机直接将修改指令(修改指令的开销远远小于数据的开销)发送给备机,由备机通过执行该修改指令修改其分区表,因此能够节省主机上的第一分区表和备机上的第二分区表进行同步的同步开销。
如图7所示,本发明实施例还提供一种数据表的处理方法,该处理方法应用于数据库系统集群中的主机,该数据库系统集群包括主机和备机,该处理方法包括:
S201、主机获取查询指令,该查询指令包括第一查询列和与第一查询列对应的第一查询条件。
其中,该查询指令用于查询分区表中满足第一查询条件的数据。
S202、在第一查询列与第一分区表的第一分区键相同的情况下,主机对第一分区表执行该查询指令。
其中,第一分区表是对主机上的第一数据表的数据按照第一分区键分区 得到的。第一数据表中可以包括多个业务的数据,且每个业务的数据可以理解为第一数据表中的一列数据,即每个业务可以理解为第一数据表中的一列的表头。如此,第一分区键可以理解为多个业务中的一个业务,即第一分区键可以理解为第一数据表中一列的表头;第一分区表为对应于该业务的分区表。
本发明实施例中,上述S201和S202的其他描述具体可参见上述如图3所示的实施例中对S106-S107的相关描述及举例,为了避免重复,此处不再赘述。
本发明实施例中,在执行S201之前,主机在主机上创建第一数据表,并对第一数据表的数据按照第一分区键分区以得到第一分区表;备机在备机上创建与第一数据表相同的第二数据表,并对第二数据表按照第二分区键分区以得到第二分区表。具体的,主机创建第一数据表和得到第一分区表,以及备机创建第二数据表和得到第二分区表的方法可参见上述如图2所示的实施例中对S101-S105的相关描述及举例,为了避免重复,此处不再赘述。
S203、在第一查询列与第二分区表的第二分区键相同的情况下,主机向备机发送该查询指令。
S204、备机接收主机发送的查询指令。
S205、备机对第二分区表执行该查询指令。
其中,第二分区表是对备机上的第二数据表的数据按照第二分区键分区得到的,第二数据表与主机上的第一数据表相同,第二分区键与上述第一分区键不同。第二数据表、第二分区键以及第二分区表分别与第一数据表、第一分区键以及第一分区表类似,具体可参见上述对第一数据表、第一分区键以及第一分区表的相关描述,此处不再赘述。
本发明实施例中,上述S201和S203-S205的描述具体可参见上述如图4所示的实施例中对S108-S111的相关描述及举例,为了避免重复,此处不再赘述。
需要说明的是,在上述S201之后,S202和S203-S205择一执行;即在S201之后执行S202或者执行S203-S205。为了清楚地描述S202和S203-S205的执行,图7中S202和S203-S205均以虚线表示。
本发明实施例提供的数据表的处理方法,由于第一分区表是对主机上的第一数据表的数据按照第一分区键分区得到的,且第二分区表是对备机上与第一数据表相同的第二数据表的数据按照第二分区键分区得到的,因此当主机获取的查询指令中的第一查询列与第一分区键相同时,可以由主机对该第一分区表执行该查询指令,当主机获取的查询指令中的第一查询列与第二分区键相同时,可以由主机向备机发送该查询指令,由备机对该第二分区表执行该查询指令。由于可以在主机和备机上对相同的数据表按照不同的分区键分区,以得到不同的分区表,因此与现有技术相比,本发明实施例提供的数据表的处理方法,由于主机和备机均无需存储多个相同的分区表,因此可以减少主机和备机中存储的分区表的数量,从而能够节省数据库系统集群中的 物理机(包括主机和备机)的存储空间,进而提升数据处理的性能,即能够更好地实现对数据的管理。
可选的,本发明实施例中,在上述第一查询列与第一分区表的第一分区键相同的情况下,查询指令还包括第二查询列和第二查询条件,第二查询列与第二分区表的第二分区键相同,第一查询条件和第二查询条件之间为“与”的关系,查询指令还用于查询第一分区表中满足第二查询条件的数据,第二分区表是对备机上的第二数据表的数据按照第二分区键分区得到的,第二数据表和第一数据表相同,第二分区键与第一分区键不同。
本发明实施例中,当查询指令还包括第二查询列和第二查询条件,且第二查询列与第二分区键相同,以及第一查询条件和第二查询条件之间为“与”的关系时的描述具体可参见上述如图5所示的实施例中对S112-S113的相关描述及举例,为了避免重复,此处不再赘述。
可选的,本发明实施例中,在上述第一查询列与第一分区表的第一分区键相同的情况下,查询指令还包括第二查询列和第二查询条件,第二查询列与第二分区表的第二分区键相同,第一查询条件和第二查询条件之间为“或”的关系,查询指令还用于查询第二分区表中满足第二查询条件的数据,结合图7,如图8所示,在S201之后,本发明实施例提供的数据表的处理方法还可以包括:
S206、主机将查询指令拆分为第一查询指令和第二查询指令。
其中,第一查询指令包括第一查询列和第一查询条件,第二查询指令包括第二查询列和第二查询条件,第二分区表是对备机上的第二数据表的数据按照第二分区键分区得到的,第二数据表和主机上的第一数据表相同,第二分区键与第一分区键不同。
S207、主机向备机发送第二查询指令。
S208、备机接收主机发送的第二查询指令。
S209、备机对第二分区表执行第二查询指令。
其中,如图8所示,上述如图7所示的S202具体可以包括S202a:
S202a、主机对第一分区表执行第一查询指令。
本发明实施例中,当查询指令还包括第二查询列和第二查询条件,且第二查询列与第二分区键相同,以及第一查询条件和第二查询条件之间为“或”的关系时,上述S201和S206-S210的描述具体可参见上述如图6所示的实施例中对S114-S119的相关描述及举例,为了避免重复,此处不再赘述。
本发明实施例中,当查询指令包括两个查询条件(实际使用中还可以是多个查询条件)时,主机可根据两个查询条件的关系具体确定由哪个物理机(主机或备机)执行该查询指令。从而基于采用本发明实施例提供的数据表的处理方法得到的分区表,可以在一定程度上提高对该分区表进行查询的查询效率。
如图9所示,本发明实施例提供一种物理机,该物理机为数据库系统集 群中的主机,该数据库系统集群包括主机和备机,该主机包括:
获取单元10,用于获取第一分区指令和第二分区指令,第一分区指令包括第一分区键,第二分区指令包括第二分区键,第二分区键与第一分区键不同;执行单元11,用于根据获取单元10获取的第一分区指令,对主机上的第一数据表的数据按照第一分区键分区,以得到第一分区表;发送单元12,用于向备机发送获取单元10获取的第二分区指令,第二分区指令用于触发备机对备机上的第二数据表的数据按照第二分区键分区,以得到第二分区表,第二数据表与第一数据表相同。
可选的,获取单元10,还用于获取查询指令,该查询指令包括查询列和查询条件,该查询列与第一分区键相同,该查询指令用于查询第一分区表中满足该查询条件的数据;执行单元11,还用于对第一分区表执行获取单元10获取的1查询指令。
可选的,获取单元10,还用于获取查询指令,该查询指令包括查询列和查询条件,该查询列与第二分区键相同,该查询指令用于查询第二分区表中满足该查询条件的数据;发送单元12,还用于向备机发送获取单元10获取的查询指令,以使备机对第二分区表执行该查询指令。
可选的,获取单元10,还用于获取查询指令,该查询指令包括第一查询列、与第一查询列对应的第一查询条件、第二查询列和与第二查询列对应的第二查询条件,第一查询列与第一分区键相同,第二查询列与第二分区键相同,第一查询条件和第二查询条件之间为“与”的关系,该查询指令用于查询第一分区表中满足第一查询条件和第二查询条件的数据;执行单元11,还用于对第一分区表执行获取单元10获取的该查询指令。
可选的,获取单元10,还用于获取查询指令,该查询指令包括第一查询列、与第一查询列对应的第一查询条件、第二查询列和与第二查询列对应的第二查询条件,第一查询列与第一分区键相同,第二查询列与第二分区键相同,第一查询条件和第二查询条件之间为“或”的关系,该查询指令用于查询第一分区表中满足第一查询条件的数据,以及查询第二分区表中满足第二查询条件的数据。执行单元11,还用于将获取单元10获取的该查询指令拆分为第一查询指令和第二查询指令,第一查询指令包括第一查询列和第一查询条件,第二查询指令包括第二查询列和第二查询条件;并对第一分区表执行第一查询指令;发送单元12,还用于向备机发送执行单元11拆分后的第二查询指令,以使备机对第二分区表执行第二查询指令。
本发明实施例中,上述获取单元10和执行单元11均可以通过一个或多个处理器实现;上述发送单元12可以通过接口电路实现。示例性的,上述发送单元12具体可以为物理机上的接口电路(必要时还可以包括相应的软件接口)。
本发明实施例提供的物理机为数据库系统集群中的主机,由于可以在主机上按照第一分区键对主机上的第一数据表分区得到第一分区表,在备机上按照与第一分区键不同的第二分区键,对备机上与第一数据表相同的第二数 据表分区得到第二分区表,即可以在主机和备机上对相同的数据表按照不同的分区键分区,以得到不同的分区表,因此与现有技术相比,本发明实施例提供的数据表的处理方法,由于主机和备机均无需存储多个相同的分区表,因此可以减少主机和备机中存储的分区表的数量,从而能够节省数据库系统集群中的物理机(包括主机和备机)的存储空间,进而提升数据处理的性能,即能够更好地实现对数据的管理。
如图10所示,本发明实施例提供一种物理机,该物理机为数据库系统集群中的备机,该数据库系统集群包括主机和备机,该备机包括:
接收单元20,用于接收主机发送的分区指令,该分区指令包括分区键;执行单元21,用于根据接收单元20接收的该分区指令,对备机上的第二数据表的数据按照该分区键分区,以得到分区表,第二数据表与主机上的第一数据表相同。
本实施例中,第一数据表按照与该分区键不同的分区键分区。其中,主机对第一数据表分区的分区键称为第一分区键,主机对第一数据表分区后得到的分区表称为第一分区表;备机对第二数据表分区的分区键称为第二分区键,备机对第二数据表分区后得到的分区表称为第二分区表。
可选的,接收单元20,还用于接收主机发送的查询指令,该查询指令包括查询列和查询条件,该查询列与该分区键相同,该查询指令用于查询该分区表中满足该查询条件的数据;执行单元21,还用于对该分区表执行接收单元20接收的该查询指令。
本发明实施例中,上述执行单元21可以通过一个或多个处理器实现;上述接收单元20可以通过接口电路实现。示例性的,上述接收单元20具体可以为物理机上的接口电路(必要时还可以包括相应的软件接口)。
本发明实施例提供的物理机为数据库系统集群中的备机,由于可以在备机上按照与主机上对第一数据表分区的第一分区键不同的第二分区键,对与主机上的第一数据表相同的第二数据表分区,以得到与主机上的第一分区表不同的第二分区表,即可以在主机和备机上对相同的数据表按照不同的分区键分区,以得到不同的分区表,因此与现有技术相比,本发明实施例提供的数据表的处理方法,由于主机和备机均无需存储多个相同的分区表,因此可以减少主机和备机中存储的分区表的数量,从而能够节省数据库系统集群中的物理机(包括主机和备机)的存储空间,进而提升数据处理的性能,即能够更好地实现对数据的管理。
如图11所示,本发明实施例提供一种物理机,该物理机为数据库系统集群中的主机,该数据库系统集群包括主机和备机,该主机包括:
获取单元30,用于获取查询指令,该查询指令包括第一查询列和与第一查询列对应的第一查询条件,该查询指令用于查询分区表中满足第一查询条件的数据;执行单元31,用于在第一查询列与第一分区表的第一分区键相同的情况下,对第一分区表执行获取单元30获取的该查询指令,第一分区表是对主机上的第一数据表的数据按照第一分区键分区得到的;发送单元32,用 于在第一查询列与第二分区表的第二分区键相同的情况下,向备机发送获取单元30获取的该查询指令,以使备机对第二分区表执行该查询指令,第二分区表是对备机上的第二数据表的数据按照第二分区键分区得到的,第二数据表与第一数据表相同,第二分区键与第一分区键不同。
可选的,在第一查询列与第一分区表的第一分区键相同的情况下,该查询指令还包括第二查询列和第二查询条件,第二查询列与第二分区表的第二分区键相同,第一查询条件和第二查询条件之间为“与”的关系,该查询指令还用于查询第一分区表中满足第二查询条件的数据,第二分区表是对备机上的第二数据表的数据按照第二分区键分区得到的,第二数据表和第一数据表相同,第二分区键与第一分区键不同。
可选的,在第一查询列与第一分区表的第一分区键相同的情况下,该查询指令还包括第二查询列和第二查询条件,第二查询列与第二分区表的第二分区键相同,第一查询条件和第二查询条件之间为“或”的关系,该查询指令还用于查询第二分区表中满足第二查询条件的数据,
执行单元31,还用于将获取单元30获取的查询指令拆分为第一查询指令和第二查询指令,第一查询指令包括第一查询列和第一查询条件,第二查询指令包括第二查询列和第二查询条件,第二分区表是对备机上的第二数据表的数据按照第二分区键分区得到的,第二数据表和第一数据表相同,第二分区键与第一分区键不同;发送单元32,还用于向备机发送执行单元31拆分后的第二查询指令,以使备机对第二分区表执行第二查询指令;执行单元31,具体用于对第一分区表执行第一查询指令。
本发明实施例中,上述获取单元30和执行单元31均可以通过一个或多个处理器实现;上述发送单元32可以通过接口电路实现。示例性的,上述发送单元32具体可以为物理机上的接口电路(必要时还可以包括相应的软件接口)。
本发明实施例提供的物理机为数据库系统集群中的主机,由于第一分区表是对主机上的第一数据表的数据按照第一分区键分区得到的,且第二分区表是对备机上与第一数据表相同的第二数据表的数据按照第二分区键分区得到的,因此当主机获取的查询指令中的第一查询列与第一分区键相同时,可以由主机对该第一分区表执行该查询指令,当主机获取的查询指令中的第一查询列与第二分区键相同时,可以由主机向备机发送该查询指令,由备机对该第二分区表执行该查询指令。由于可以在主机和备机上对相同的数据表按照不同的分区键分区,以得到不同的分区表,因此与现有技术相比,本发明实施例提供的数据表的处理方法,由于主机和备机均无需存储多个相同的分区表,因此可以减少主机和备机中存储的分区表的数量,从而能够节省数据库系统集群中的物理机(包括主机和备机)的存储空间,进而提升数据处理的性能,即能够更好地实现对数据的管理。
如图10所示,本发明实施例提供一种物理机,该物理机为数据库系统集群中的备机,该数据库系统集群包括主机和备机,该备机包括:
接收单元20,用于接收主机发送的查询指令,该查询指令包括查询列和查询条件,该查询列与分区表的分区键相同,该查询指令用于查询该分区表中满足该查询条件的数据,该分区表是对备机上的第二数据表的数据按照该分区键分区得到的,第二数据表和主机上的第一数据表相同;执行单元21,用于对该分区表执行接收单元20接收的该查询指令。
本发明实施例中,上述执行单元21可以通过一个或多个处理器实现;上述接收单元20可以通过接口电路实现。示例性的,上述接收单元20具体可以为物理机上的接口电路(必要时还可以包括相应的软件接口)。
本发明实施例提供的物理机为数据库系统集群中的备机,由于该分区表是对备机上与主机上的第一数据表相同的第二数据表的数据按照该分区键分区得到的,因此当主机获取的查询指令中的查询列与该分区键相同时,主机向备机发送该查询指令,由备机对该分区表执行该查询指令。与现有技术相比,本发明实施例提供的数据表的处理方法,由于备机无需存储多个与主机存储的分区表相同的分区表,因此可以减少备机中存储的分区表的数量,从而能够节省数据库系统集群中的备机的存储空间,进而提升数据处理的性能,即能够更好地实现对数据的管理。
如图12所示,本发明实施例提供一种物理机,该物理机包括处理器40、接口电路41、存储器42和系统总线43。
存储器42用于存储计算机执行指令,处理器40、接口电路41和存储器42通过系统总线43相互连接,当该物理机运行时,处理器40执行存储器42存储的计算机执行指令,以使该物理机执行本发明实施例提供的数据表的处理方法。
第一种可能的实现方式中,当如图12所示的物理机为上述如图9所示的主机时,上述如图9所示的获取单元10和执行单元11可以通过一个或多个如图12所示的处理器40实现;上述如图9所示的发送单元12可以通过如图12所示的接口电路41实现。
第二种可能的实现方式中,当如图12所示的物理机为上述如图10所示的备机时,上述如图10所示的执行单元21可以通过一个或多个如图12所示的处理器40实现;上述如图10所示的接收单元20可以通过如图12所示的接口电路41实现。
第三种可能的实现方式中,当如图12所示的物理机为上述如图11所示的主机时,上述如图11所示的获取单元30和执行单元31可以通过一个或多个如图12所示的处理器40实现;上述如图11所示的发送单元32可以通过如图12所示的接口电路41实现。
第四种可能的实现方式中,当如图12所示的物理机为上述如图10所示的备机时,上述如图10所示的执行单元21可以通过一个或多个如图12所示的处理器40实现;上述如图10所示的接收单元20可以通过如图12所示的接口电路41实现。
在第一种可能的实现方式和第二种可能的实现方式中,如图12所示的物 理机执行如图2至图6任意之一所示的数据表的处理方法。在第三种可能的实现方式和第四种可能的实现方式中,如图12所示的物理机执行如图7至图8任意之一所示的数据表的处理方法。对于如图2至图6任意之一,以及图7至图8任意之一所示的数据表的处理方法,具体可参见上述实施例中的相关描述,为了避免重复,此处不再赘述。
处理器40可以通过一个或多个处理器实现,图12仅以一个处理器为例进行示例性的说明。处理器40可以为中央处理器(central processing unit,CPU)。处理器40还可以为其他通用处理器、数字信号处理器(digital signal processing,DSP)、专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field-programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
接口电路41具体可以是物理机上的通信接口。该通信接口可以为无线通信接口。例如,无线通信接口可以是物理机的无线模块等。处理器40通过接口电路41与其他设备,例如其他物理机之间进行数据的收发。
存储器42可以包括易失性存储器(volatile memory),例如随机存取存储器(random-access memory,RAM);存储器42也可以包括非易失性存储器(non-volatile memory),例如只读存储器(read-only memory,ROM),快闪存储器(flash memory),硬盘(hard disk drive,HDD)或固态硬盘(solid-state drive,SSD);存储器42还可以包括上述种类的存储器的组合。
存储器42可以包括底层存储介质和内存。其中,内存耦合至底层存储介质,用于作为底层存储介质的缓存。
系统总线43可以包括数据总线、电源总线、控制总线和信号状态总线等。本实施例中为了清楚说明,在图12中将各种总线都示意为系统总线43。
可选的,本实施例还提供一种可读存储介质,该可读存储介质包括计算机执行指令,当物理机运行时,物理机的处理器执行该计算机执行指令,以使物理机执行本发明实施例提供的如图2至图6任意之一或者如图7至图8任意之一所示的数据表的处理方法。
可选的,本实施例中的可读存储介质可以为上述如图12所示的存储器42。
本发明实施例提供的物理机为数据库系统集群中的主机或备机,应用于上述如图2至图6任意之一所示的数据表的处理方法,由于可以在主机上按照第一分区键对主机上的第一数据表分区得到第一分区表,在备机上按照与第一分区键不同的第二分区键,对备机上与第一数据表相同的第二数据表分区得到第二分区表,即可以在主机和备机上对相同的数据表按照不同的分区键分区,以得到不同的分区表,因此与现有技术相比,本发明实施例提供的数据表的处理方法,由于主机和备机均无需存储多个相同的分区表,因此可以减少主机和备机中存储的分区表的数量,从而能够节省数据库系统集群中的物理机(包括主机和备机)的存储空间,进而提升数据处理的性能,即能 够更好地实现对数据的管理。
本发明实施例提供的物理机为数据库系统集群中的主机或备机,应用于上述如图7至图8任意之一所示的数据表的处理方法,由于第一分区表是对主机上的第一数据表的数据按照第一分区键分区得到的,且第二分区表是对备机上与第一数据表相同的第二数据表的数据按照第二分区键分区得到的,因此当主机获取的查询指令中的第一查询列与第一分区键相同时,可以由主机对该第一分区表执行该查询指令,当主机获取的查询指令中的第一查询列与第二分区键相同时,可以由主机向备机发送该查询指令,由备机对该第二分区表执行该查询指令。由于可以在主机和备机上对相同的数据表按照不同的分区键分区,以得到不同的分区表,因此与现有技术相比,本发明实施例提供的数据表的处理方法,由于主机和备机均无需存储多个相同的分区表,因此可以减少主机和备机中存储的分区表的数量,从而能够节省数据库系统集群中的物理机(包括主机和备机)的存储空间,进而提升数据处理的性能,即能够更好地实现对数据的管理。
通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个 存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。

Claims (19)

  1. 一种数据表的处理方法,其特征在于,所述处理方法应用于数据库系统集群中的主机,所述数据库系统集群包括所述主机和备机,所述处理方法包括:
    所述主机获取第一分区指令和第二分区指令,所述第一分区指令包括第一分区键,所述第二分区指令包括第二分区键,所述第二分区键与所述第一分区键不同;
    所述主机根据所述第一分区指令,对所述主机上的第一数据表的数据按照所述第一分区键分区,以得到第一分区表;
    所述主机向所述备机发送所述第二分区指令,所述第二分区指令用于触发所述备机对所述备机上的第二数据表的数据按照所述第二分区键分区,以得到第二分区表,所述第二数据表与所述第一数据表相同。
  2. 根据权利要求1所述的处理方法,其特征在于,所述处理方法还包括:
    所述主机获取查询指令,所述查询指令包括查询列和查询条件,所述查询列与所述第一分区键相同,所述查询指令用于查询所述第一分区表中满足所述查询条件的数据;
    所述主机对所述第一分区表执行所述查询指令。
  3. 根据权利要求1所述的处理方法,其特征在于,所述处理方法还包括:
    所述主机获取查询指令,所述查询指令包括查询列和查询条件,所述查询列与所述第二分区键相同,所述查询指令用于查询所述第二分区表中满足所述查询条件的数据;
    所述主机向所述备机发送所述查询指令,以使所述备机对所述第二分区表执行所述查询指令。
  4. 根据权利要求1所述的处理方法,其特征在于,所述处理方法还包括:
    所述主机获取查询指令,所述查询指令包括第一查询列、与所述第一查询列对应的第一查询条件、第二查询列和与所述第二查询列对应的第二查询条件,所述第一查询列与所述第一分区键相同,所述第二查询列与所述第二分区键相同,所述第一查询条件和所述第二查询条件之间为“与”的关系,所述查询指令用于查询所述第一分区表中满足所述第一查询条件和所述第二查询条件的数据;
    所述主机对所述第一分区表执行所述查询指令。
  5. 根据权利要求1所述的处理方法,其特征在于,所述处理方法还包括:
    所述主机获取查询指令,所述查询指令包括第一查询列、与所述第一查询列对应的第一查询条件、第二查询列和与所述第二查询列对应的第二查询条件,所述第一查询列与所述第一分区键相同,所述第二查询列与所述第二分区键相同,所述第一查询条件和所述第二查询条件之间为“或”的关系,所述查询指令用于查询所述第一分区表中满足所述第一查询条件的数据,以及查询所述第二分区表中满足所述第二查询条件的数据;
    所述主机将所述查询指令拆分为第一查询指令和第二查询指令,所述第一 查询指令包括所述第一查询列和所述第一查询条件,所述第二查询指令包括所述第二查询列和所述第二查询条件;
    所述主机对所述第一分区表执行所述第一查询指令;
    所述主机向所述备机发送所述第二查询指令,以使所述备机对所述第二分区表执行所述第二查询指令。
  6. 一种数据表的处理方法,其特征在于,所述处理方法应用于数据库系统集群中的主机,所述数据库系统集群包括所述主机和备机,所述处理方法包括:
    所述主机获取查询指令,所述查询指令包括第一查询列和与所述第一查询列对应的第一查询条件,所述查询指令用于查询分区表中满足所述第一查询条件的数据;
    在所述第一查询列与第一分区表的第一分区键相同的情况下,所述主机对所述第一分区表执行所述查询指令,所述第一分区表是对所述主机上的第一数据表的数据按照所述第一分区键分区得到的;
    在所述第一查询列与第二分区表的第二分区键相同的情况下,所述主机向所述备机发送所述查询指令,以使所述备机对所述第二分区表执行所述查询指令,所述第二分区表是对所述备机上的第二数据表的数据按照所述第二分区键分区得到的,所述第二数据表与所述第一数据表相同,所述第二分区键与所述第一分区键不同。
  7. 根据权利要求6所述的处理方法,其特征在于,在所述第一查询列与第一分区表的第一分区键相同的情况下,
    所述查询指令还包括第二查询列和第二查询条件,所述第二查询列与第二分区表的第二分区键相同,所述第一查询条件和所述第二查询条件之间为“与”的关系,所述查询指令还用于查询所述第一分区表中满足所述第二查询条件的数据,所述第二分区表是对所述备机上的第二数据表的数据按照所述第二分区键分区得到的,所述第二数据表和所述第一数据表相同,所述第二分区键与所述第一分区键不同。
  8. 根据权利要求6所述的处理方法,其特征在于,在所述第一查询列与第一分区表的第一分区键相同的情况下,
    所述查询指令还包括第二查询列和第二查询条件,所述第二查询列与第二分区表的第二分区键相同,所述第一查询条件和所述第二查询条件之间为“或”的关系,所述查询指令还用于查询所述第二分区表中满足所述第二查询条件的数据,所述处理方法还包括:
    所述主机将所述查询指令拆分为第一查询指令和第二查询指令,所述第一查询指令包括所述第一查询列和所述第一查询条件,所述第二查询指令包括所述第二查询列和所述第二查询条件,所述第二分区表是对所述备机上的第二数据表的数据按照所述第二分区键分区得到的,所述第二数据表和所述第一数据表相同,所述第二分区键与所述第一分区键不同;
    所述主机向所述备机发送所述第二查询指令,以使所述备机对所述第二分 区表执行所述第二查询指令;
    所述主机对所述第一分区表执行所述查询指令,包括:
    所述主机对所述第一分区表执行所述第一查询指令。
  9. 一种物理机,其特征在于,所述物理机为数据库系统集群中的主机,所述数据库系统集群包括所述主机和备机,所述主机包括:
    获取单元,用于获取第一分区指令和第二分区指令,所述第一分区指令包括第一分区键,所述第二分区指令包括第二分区键,所述第二分区键与所述第一分区键不同;
    执行单元,用于根据所述获取单元获取的所述第一分区指令,对所述主机上的第一数据表的数据按照所述第一分区键分区,以得到第一分区表;
    发送单元,用于向备机发送所述获取单元获取的所述第二分区指令,所述第二分区指令用于触发所述备机对所述备机上的第二数据表的数据按照所述第二分区键分区,以得到第二分区表,所述第二数据表与所述第一数据表相同。
  10. 根据权利要求9所述的物理机,其特征在于,
    所述获取单元,还用于获取查询指令,所述查询指令包括查询列和查询条件,所述查询列与所述第一分区键相同,所述查询指令用于查询所述第一分区表中满足所述查询条件的数据;
    所述执行单元,还用于对所述第一分区表执行所述获取单元获取的所述查询指令。
  11. 根据权利要求9所述的物理机,其特征在于,
    所述获取单元,还用于获取查询指令,所述查询指令包括查询列和查询条件,所述查询列与所述第二分区键相同,所述查询指令用于查询所述第二分区表中满足所述查询条件的数据;
    所述发送单元,还用于向所述备机发送所述获取单元获取的所述查询指令,以使所述备机对所述第二分区表执行所述查询指令。
  12. 根据权利要求9所述的物理机,其特征在于,
    所述获取单元,还用于获取查询指令,所述查询指令包括第一查询列、与所述第一查询列对应的第一查询条件、第二查询列和与所述第二查询列对应的第二查询条件,所述第一查询列与所述第一分区键相同,所述第二查询列与所述第二分区键相同,所述第一查询条件和所述第二查询条件之间为“与”的关系,所述查询指令用于查询所述第一分区表中满足所述第一查询条件和所述第二查询条件的数据;
    所述执行单元,还用于对所述第一分区表执行所述获取单元获取的所述查询指令。
  13. 根据权利要求9所述的物理机,其特征在于,
    所述获取单元,还用于获取查询指令,所述查询指令包括第一查询列、与所述第一查询列对应的第一查询条件、第二查询列和与所述第二查询列对应的第二查询条件,所述第一查询列与所述第一分区键相同,所述第二查询列与所述第二分区键相同,所述第一查询条件和所述第二查询条件之间为“或”的关 系,所述查询指令用于查询所述第一分区表中满足所述第一查询条件的数据,以及查询所述第二分区表中满足所述第二查询条件的数据;
    所述执行单元,还用于将所述获取单元获取的所述查询指令拆分为第一查询指令和第二查询指令,所述第一查询指令包括所述第一查询列和所述第一查询条件,所述第二查询指令包括所述第二查询列和所述第二查询条件;并对所述第一分区表执行所述第一查询指令;
    所述发送单元,还用于向所述备机发送所述执行单元拆分后的所述第二查询指令,以使所述备机对所述第二分区表执行所述第二查询指令。
  14. 一种物理机,其特征在于,所述物理机为数据库系统集群中的主机,所述数据库系统集群包括所述主机和备机,所述主机包括:
    获取单元,用于获取查询指令,所述查询指令包括第一查询列和与所述第一查询列对应的第一查询条件,所述查询指令用于查询分区表中满足所述第一查询条件的数据;
    执行单元,用于在所述第一查询列与第一分区表的第一分区键相同的情况下,对所述第一分区表执行所述获取单元获取的所述查询指令,所述第一分区表是对所述主机上的第一数据表的数据按照所述第一分区键分区得到的;
    发送单元,用于在所述第一查询列与第二分区表的第二分区键相同的情况下,向所述备机发送所述获取单元获取的所述查询指令,以使所述备机对所述第二分区表执行所述查询指令,所述第二分区表是对所述备机上的第二数据表的数据按照所述第二分区键分区得到的,所述第二数据表与所述第一数据表相同,所述第二分区键与所述第一分区键不同。
  15. 根据权利要求14所述的物理机,其特征在于,在所述第一查询列与第一分区表的第一分区键相同的情况下,
    所述查询指令还包括第二查询列和第二查询条件,所述第二查询列与第二分区表的第二分区键相同,所述第一查询条件和所述第二查询条件之间为“与”的关系,所述查询指令还用于查询所述第一分区表中满足所述第二查询条件的数据,所述第二分区表是对所述备机上的第二数据表的数据按照所述第二分区键分区得到的,所述第二数据表和所述第一数据表相同,所述第二分区键与所述第一分区键不同。
  16. 根据权利要求14所述的物理机,其特征在于,在所述第一查询列与第一分区表的第一分区键相同的情况下,
    所述查询指令还包括第二查询列和第二查询条件,所述第二查询列与第二分区表的第二分区键相同,所述第一查询条件和所述第二查询条件之间为“或”的关系,所述查询指令还用于查询所述第二分区表中满足所述第二查询条件的数据,
    所述执行单元,还用于将所述获取单元获取的所述查询指令拆分为第一查询指令和第二查询指令,所述第一查询指令包括所述第一查询列和所述第一查询条件,所述第二查询指令包括所述第二查询列和所述第二查询条件,所述第二分区表是对所述备机上的第二数据表的数据按照所述第二分区键分区得到 的,所述第二数据表和所述第一数据表相同,所述第二分区键与所述第一分区键不同;
    所述发送单元,还用于向所述备机发送所述执行单元拆分后的所述第二查询指令,以使所述备机对所述第二分区表执行所述第二查询指令;
    所述执行单元,具体用于对所述第一分区表执行所述第一查询指令。
  17. 一种物理机,其特征在于,所述物理机为数据库系统集群中的主机,所述数据库系统集群包括所述主机和备机,所述主机包括处理器、接口电路、存储器和系统总线;
    所述存储器用于存储计算机执行指令,所述处理器、所述接口电路和所述存储器通过所述系统总线相互连接,当所述主机运行时,所述处理器执行所述存储器存储的所述计算机执行指令,以使所述主机执行如权利要求1至5任意一项所述的数据表的处理方法。
  18. 一种物理机,其特征在于,所述物理机为数据库系统集群中的主机,所述数据库系统集群包括所述主机和备机,所述主机包括处理器、接口电路、存储器和系统总线;
    所述存储器用于存储计算机执行指令,所述处理器、所述接口电路和所述存储器通过所述系统总线相互连接,当所述主机运行时,所述处理器执行所述存储器存储的所述计算机执行指令,以使所述主机执行如权利要求6至8任意一项所述的数据表的处理方法。
  19. 一种数据库系统集群,其特征在于,所述数据库系统集群包括主机和至少一个备机,其中:
    所述主机如权利要求9至13任意一项或17所述,所述主机与所述至少一个备机进行交互,其中,所述备机用于接收所述主机发送的第二分区指令以及根据所述第二分区指令对所述备机上的第二数据表的数据按照所述第二分区指令中的第二分区键分区以得到第二分区表;或者,
    所述主机如权利要求14至16任意一项或18所述,所述主机与所述至少一个备机进行交互,其中,所述备机用于接收所述主机发送的查询指令以及对所述备机上的第二分区表执行所述查询指令。
PCT/CN2017/075998 2016-05-31 2017-03-08 一种数据表的处理方法、装置及系统 WO2017206562A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US16/204,526 US20190108174A1 (en) 2016-05-31 2018-11-29 Data Table Processing Method and Apparatus

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610379416.8A CN107451154B (zh) 2016-05-31 2016-05-31 一种数据表的处理方法、装置及系统
CN201610379416.8 2016-05-31

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US16/204,526 Continuation US20190108174A1 (en) 2016-05-31 2018-11-29 Data Table Processing Method and Apparatus

Publications (1)

Publication Number Publication Date
WO2017206562A1 true WO2017206562A1 (zh) 2017-12-07

Family

ID=60479708

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/075998 WO2017206562A1 (zh) 2016-05-31 2017-03-08 一种数据表的处理方法、装置及系统

Country Status (3)

Country Link
US (1) US20190108174A1 (zh)
CN (1) CN107451154B (zh)
WO (1) WO2017206562A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110019274B (zh) * 2017-12-29 2023-09-26 阿里巴巴集团控股有限公司 一种数据库系统以及查询数据库的方法和装置
US11347705B2 (en) * 2019-04-02 2022-05-31 Sap Se Supporting scalable distributed secondary index using replication engine for high-performance distributed database systems
CN113590613A (zh) * 2021-07-13 2021-11-02 上海一谈网络科技有限公司 数据表分区方法、装置、计算机设备和存储介质

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120331335A1 (en) * 2011-06-23 2012-12-27 International Business Machines Corporation High availability database systems and methods
CN104199881A (zh) * 2014-08-21 2014-12-10 广州华多网络科技有限公司 数据库集群、数据查询方法、数据同步方法和装置
CN104871153A (zh) * 2012-10-29 2015-08-26 华为技术有限公司 用于灵活的分布式大规模并行处理(mpp)数据库的系统和方法

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101086732A (zh) * 2006-06-11 2007-12-12 上海全成通信技术有限公司 一种海量数据管理方法
US7650394B2 (en) * 2006-09-15 2010-01-19 Microsoft Corporation Synchronizing email recipient lists using block partition information
CN101556589A (zh) * 2008-04-09 2009-10-14 北京闻言科技有限公司 一种Oracle在数据库中定期淘汰过期数据的方法
US20100169289A1 (en) * 2008-12-30 2010-07-01 International Business Machines Corporation Two Phase Commit With Grid Elements
US8904381B2 (en) * 2009-01-23 2014-12-02 Hewlett-Packard Development Company, L.P. User defined data partitioning (UDP)—grouping of data based on computation model
CN101572625A (zh) * 2009-04-24 2009-11-04 北京锐安科技有限公司 一种ip分区方法
CN101876983B (zh) * 2009-04-30 2012-11-28 国际商业机器公司 数据库分区方法与系统
CN103440301B (zh) * 2013-08-21 2017-06-13 曙光信息产业股份有限公司 一种数据多副本混合存储方法及系统
CN103942287B (zh) * 2014-04-10 2017-06-06 大唐移动通信设备有限公司 海量数据处理方法、数据库服务器及应用服务器
US10002148B2 (en) * 2014-07-22 2018-06-19 Oracle International Corporation Memory-aware joins based in a database cluster
CN105069134B (zh) * 2015-08-18 2018-07-27 上海新炬网络信息技术股份有限公司 一种Oracle统计信息自动收集方法

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120331335A1 (en) * 2011-06-23 2012-12-27 International Business Machines Corporation High availability database systems and methods
CN104871153A (zh) * 2012-10-29 2015-08-26 华为技术有限公司 用于灵活的分布式大规模并行处理(mpp)数据库的系统和方法
CN104199881A (zh) * 2014-08-21 2014-12-10 广州华多网络科技有限公司 数据库集群、数据查询方法、数据同步方法和装置

Also Published As

Publication number Publication date
US20190108174A1 (en) 2019-04-11
CN107451154B (zh) 2021-03-30
CN107451154A (zh) 2017-12-08

Similar Documents

Publication Publication Date Title
US10331642B2 (en) Data storage method and apparatus
WO2018036148A1 (zh) 一种服务器集群系统
US20160179836A1 (en) Method for updating data table of keyvalue database and apparatus for updating table data
WO2018058998A1 (zh) 一种数据加载方法、终端和计算集群
US11030178B2 (en) Data storage method and apparatus
TW201839636A (zh) 一種資料庫的切換方法、主要伺服器以及從屬伺服器
EP3474146B1 (en) Data processing method, storage system and exchange device
WO2015169067A1 (en) Method, device, and system for peer-to-peer data replication and method, device, and system for master node switching
US20200364080A1 (en) Interrupt processing method and apparatus and server
WO2017206562A1 (zh) 一种数据表的处理方法、装置及系统
EP3131015B1 (en) Memory migration method and device
US8060773B1 (en) Systems and methods for managing sub-clusters within a multi-cluster computing system subsequent to a network-partition event
WO2021027331A1 (zh) 基于图数据的全量关系计算方法、装置、设备及存储介质
US11226986B2 (en) Data table partitioning management method and apparatus
WO2018205689A1 (zh) 合并文件的方法、存储装置、存储设备和存储介质
US20220156324A1 (en) Graph refactorization method and graph refactorization apparatus
US11372822B2 (en) Method, device, and computer apparatus for merging regions of HBase table
WO2020134786A1 (zh) 服务器的扩容方法及装置、服务器、存储介质
US9432476B1 (en) Proxy data storage system monitoring aggregator for a geographically-distributed environment
WO2018210178A1 (zh) 文件存储方法和存储装置
CN115510016A (zh) 一种基于目录分片的客户端应答方法、装置及介质
US10712959B2 (en) Method, device and computer program product for storing data
CN115210694A (zh) 数据传输方法及装置
CN113785286B (zh) 在分布式存储系统中查询数据
JP6397105B2 (ja) データを記憶する方法及び装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17805507

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17805507

Country of ref document: EP

Kind code of ref document: A1