Method and system for database partition
Abstract
The present invention provides a flexible, dynamic database partition method and system. The method includes the steps of acquiring a data partition rule, where the data partition rule is used to identify a first relationship between a data partition condition and a database partition; establishing a second relationship between the data partition condition and a data partition key based on the data partition rule and a third relationship between the database partition and the data partition key; adding the data partition key to a data item where the data item is stored in the database based on the second relationship between the data partition condition and the data partition key; and storing the data item in the database partition based on the data partition key of the data item.
Claims
exact text as granted — not AI-modified1 . A method for partitioning data stored in a database, the method comprising:
acquiring at least one data partition rule from a set of data partition rules stored in the database, wherein each rule of the set of data partition rules comprises at least one data partition condition for a given database partition of a database, the at least one data partition condition indicates at least one condition to be satisfied by data items for association with the given database partition; pre-calculating a set of data partition keys, wherein the pre-calculating comprises:
creating a given table in the database, wherein the given table is initially empty;
selecting a set of random data partition keys;
inserting each key of the set of random data partition keys into the given table that is empty;
querying, for each key of the set of random data partition keys inserted into the given table, the database for a partition number which corresponds to the inserted data partition key, wherein the querying at least sends one or more queries to the database comprising at least one key of the set of random data partition keys inserted into the table;
receiving, based on the querying, the partition number for each of the set of random data partition keys inserted into the table; and
storing each number of the partition numbers and each key of the set of random data partition keys in a match table, wherein the match table is separate and distinct from a given database partition associated with the partition numbers and the set of random data partition keys;
identifying, based on the at least one data partition rule and the match table, a data partition key associated with the given database partition; associating, based on the identifying, the data partition key with the at least one data partition condition; determining that at least one data item stored in the database satisfies the at least one condition of the data partition condition; adding, based on the determining, the data partition key associated with the data partition condition to the at least one data item; and storing, based on the adding, the at least one data item in the given database partition according to the data partition key of the at least one data item.
2 . The method according to claim 1 , wherein the associating comprises:
recording the at least one data partition condition into the match table.
3 . The method according to claim 2 , wherein the adding comprises:
executing a data query, wherein the data query is based on the at least one data partition condition; obtaining the data item from a result of the executing the data query; querying the match table to acquire the data partition key associated with the at least one data partition condition; and adding the data partition key to the data item.
4 . The method according to claim 2 , wherein the adding comprises:
retrieving the at least one data item from the database; retrieving the data partition condition based on a set of parameters associated with the at least one data item; querying the match table to acquire the data partition key associated with the data partition condition; and adding the data partition key to the data item.
5 . The method according to claim 2 , wherein the match table is stored in a cache.
6 . The method according to claim 1 , further comprising:
assigning a partition number to the given database partition; and relating the data partition key to the partition number.
7 . The method according to claim 1 , wherein the method further comprises:
acquiring a new data item from the database; adding a given data partition key to the new data item according to a data partition condition comprising one or more conditions satisfied by the new data item; and storing, based on the given data partition key added to the new data item, the new data item in a partition of the database corresponding to the given data partition key added to the new data item.
8 . An information processing system for partitioning data stored in a database, the information processing system comprising:
a processor implemented at least partially by hardware; a memory communicatively coupled to the processor; and a data partitioning system communicatively coupled to the processor and the memory, wherein the data partitioning system is configured to perform a method comprising:
acquiring at least one data partition rule from a set of data partition rules stored in the database, wherein each rule of the set of data partition rules comprises at least one data partition condition for a given database partition of a database, the at least one data partition condition indicates at least one condition to be satisfied by data items for association with the given database partition;
pre-calculating a set of data partition keys, wherein the pre-calculating comprises:
creating a given table in the database, wherein the given table is initially empty;
selecting a set of random data partition keys;
inserting each key of the set of random data partition keys into the given table that is empty;
querying, for each key of the set of random data partition keys inserted into the given table, the database for a partition number which corresponds to the inserted data partition key, wherein the querying at least sends one or more queries to the database comprising at least one key of the set of random data partition keys inserted into the table;
receiving, based on the querying, the partition number for each of the set of random data partition keys inserted into the table; and
storing each number of the partition numbers and each key of the set of random data partition keys in a match table, wherein the match table is separate and distinct from a given database partition associated with the partition numbers and the set of random data partition keys;
identifying, based on the at least one data partition rule and the match table, a data partition key associated with the given database partition; associating, based on the identifying, the data partition key with the at least one data partition condition; determining that at least one data item stored in the database satisfies the at least one condition of the data partition condition; adding, based on the determining, the data partition key associated with the data partition condition to the at least one data item; and storing, based on the adding, the at least one data item in the given database partition according to the data partition key of the at least one data item.
9 . The information processing system according to claim 8 , wherein the associating comprises:
recording the at least one data partition condition into the match table.
10 . The information processing system according to claim 9 , wherein the adding comprises:
executing a data query, wherein the data query is based on the at least one data partition condition; obtaining the data item from a result of the executing the data query; querying the match table to acquire the data partition key associated with the at least one data partition condition; and adding the data partition key to the data item.
11 . The information processing system according to claim 9 , wherein the adding comprises:
retrieving the at least one data item from the database; retrieving the data partition condition based on a set of parameters associated with the at least one data item; querying the match table to acquire the data partition key associated with the data partition condition; and adding the data partition key to the data item.
12 . The information processing system according to claim 9 , wherein the match table is stored in a cache.
13 . The method according to claim 8 , wherein the method further comprises:
assigning a partition number to the given database partition; and relating the data partition key to the partition number.
14 . The information processing system according to claim 8 , wherein the method further comprises:
acquiring a new data item from the database; adding a given data partition key to the new data item according to a data partition condition comprising one or more conditions satisfied by the new data item; and storing, based on the given data partition key added to the new data item, the new data item in a partition of the database corresponding to the given data partition key added to the new data item.
15 . A method for partitioning data stored in a database, the method comprising:
acquiring at least one data partition rule from a set of data partition rules stored in the database, wherein each rule of the set of data partition rules comprises at least one data partition condition for a given database partition of a database, the at least one data partition condition indicates at least one condition to be satisfied by data items for association with the given database partition; pre-calculating a set of data partition keys; storing the set of data partition keys and a set of partition numbers associated with the set of data partition keys in a match table; identifying, based on the at least one data partition rule and the match table, a data partition key associated with the given database partition; associating, based on the identifying, the data partition key with the at least one data partition condition; determining that at least one data item stored in the database satisfies the at least one condition of the data partition condition; adding, based on the determining, the data partition key associated with the data partition condition to the at least one data item; and storing, based on the adding, the at least one data item in the given database partition according to the data partition key of the at least one data item.
16 . The method according to claim 15 , wherein pre-calculating the set of data partition keys comprises:
creating a given table in the database, wherein the given table is initially empty; selecting a set of random data partition keys; inserting each key of the set of random data partition keys into the given table that is empty; querying, for each key of the set of random data partition keys inserted into the given table, the database for a partition number which corresponds to the inserted data partition key, wherein the querying at least sends one or more queries to the database comprising at least one key of the set of random data partition keys inserted into the table; and receiving, based on the querying, the partition number for each of the set of random data partition keys inserted into the table.
17 . The method according to claim 16 , wherein storing the set of data partition keys and a set of partition numbers comprises:
storing each number of the partition numbers and each key of the set of random data partition keys in the match table, wherein the match table is separate and distinct from a given database partition associated with the partition numbers and the set of random data partition keys.
18 . The method according to claim 15 , wherein the associating comprises:
recording the at least one data partition condition into the match table.
19 . The method according to claim 18 , wherein the adding comprises:
executing a data query, wherein the data query is based on the at least one data partition condition; obtaining the data item from a result of the executing the data query; querying the match table to acquire the data partition key associated with the at least one data partition condition; and adding the data partition key to the data item.
20 . The method according to claim 18 , wherein the adding comprises:
retrieving the at least one data item from the database; retrieving the data partition condition based on a set of parameters associated with the at least one data item; querying the match table to acquire the data partition key associated with the data partition condition; and adding the data partition key to the data item.Join the waitlist — get patent alerts
Track US2016232208A1 — get alerts on status changes and closely related new filings.
We store only your email — no account needed. See our privacy policy.