IP Library Granted Patent US 11,640,384
Granted Patent B2
US 11,640,384 · App. 15/729,599 · Granted May 2, 2023

Database processing method, apparatus, and electronic device

Inventors: Lian Yang (Hangzhou, CN); Shaoqiang Jing (Hangzhou, CN); Shiquan Yang (Hangzhou, CN)
Assignee: Alibaba Group Holding Limited
G06F16/2365G06F16/2282G06F16/2336
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,640,384
App. No.
15/729,599
Granted
May 2, 2023
Kind
B2
Abstract

Embodiments of the disclosure provide a database processing method, a database processing apparatus, and an electronic device. The database processing method can include: providing a plurality of transactions to a transaction queue, wherein each transaction of the plurality of transactions includes an encapsulated write request for writing data into a database; generating auto-increment identifiers (IDs) for data rows of the data corresponding to the plurality of transactions according to an order of the transactions in the transaction queue; and writing the data into the database according to the auto-increment IDs assigned to the data rows of the data in the transaction.

Claims (58)

1. A database processing method, comprising:

providing a plurality of transactions to a transaction queue, wherein each transaction of the plurality of transactions includes one or more rows of data to be written into a database;

generating auto-increment identifiers (IDs) for each row in each of the plurality of transactions according to an order of the transactions in the transaction queue, wherein a last ID of a last data row of a first transaction is assigned a lower ID than a first ID of a first row of a second transaction, wherein the second transaction is later in the transaction queue than the first transaction; and

writing the rows of data into the database according to the auto-increment IDs assigned to the rows of the data corresponding to the plurality of transactions, whereby the rows of data are assigned IDs in an order corresponding to an order of the transactions in the transaction queue.

2. The database processing method according to claim 1 , wherein

an auto-increment ID for each data row of a precedent transaction in the transaction queue is less than an auto-increment ID for each data row of a later transaction in the transaction queue; and

when one transaction contains a plurality of rows of data, the auto-increment ID of a precedent data row in the transaction is less than the auto-increment ID of a later data row in the transaction.

3. The database processing method according to claim 1 , wherein writing the rows of data into the database further comprises:

writing log data corresponding to the plurality of transactions in the transaction queue in a log, the log data comprising the auto-increment IDs of the rows of data in the corresponding plurality of transactions; and

submitting the plurality of transactions corresponding to the log data in the log; and

writing the data into the database while assigning auto-increment IDs to the rows of data in the plurality of transactions.

4. The database processing method according to claim 1 , wherein

the database comprises a plurality of partitions, each partition of the plurality of partitions maintains auto-increment IDs that are independent from auto-increment IDs of other partitions; and

the database processing method further comprises:

providing the plurality of transactions to a transaction queue corresponding to a partition where the plurality of transactions belong.

5. The database processing method according to claim 1 , wherein generating auto-increment identifiers further comprises:

for each transaction in the transaction queue, generating a batch of auto-increment IDs for the rows of data in the transaction according to a system time and a number of data rows contained in the transaction.

6. The database processing method according to claim 5 , wherein:

for the rows of data in each transaction in the transaction queue, a range of the generated auto-increment IDs is from one to the number of rows of data contained in the transaction, plus a greater one of the following two numerical values: the value of the auto-increment ID generated last time, and the system time.

7. A database processing apparatus, comprising:

a memory storing a set of instructions; and

one or more processors configured to execute the set of instructions to cause the apparatus to perform:

providing a plurality of transactions to a transaction queue, wherein each transaction of the plurality of transactions includes one or more rows of data to be written into a database;

generating auto-increment identifiers (IDs) for each row in each of the plurality of transactions according to an order of the transactions in the transaction queue, wherein a last ID of a last data row of a first transaction is assigned a lower ID than a first ID of a first row of a second transaction, wherein the second transaction is later in the transaction queue than the first transaction; and

writing the rows of data into the database according to the auto-increment IDs assigned to the rows of the data corresponding to the plurality of transactions,

whereby the rows of data are assigned IDs in an order corresponding to an order of the transactions in the transaction queue.

8. The database processing apparatus according to claim 7 , wherein:

an auto-increment ID for each data row of a precedent transaction in the transaction queue is less than an auto-increment ID for each data row of a later transaction in the transaction queue; and

when one transaction contains a plurality of rows of data, the auto-increment ID of a precedent data row in the transaction is less than the auto-increment ID of a later data row in the transaction.

9. The database processing apparatus according to claim 7 , wherein, for writing the rows of data into the database, the set of instructions is executable by the one or more processors to cause the apparatus to further perform:

writing log data corresponding to the plurality of transactions in the transaction queue in a log, the log data comprising the auto-increment IDs of the rows of data in the corresponding plurality of transactions; and

submitting the plurality of transactions corresponding to the log data in the log; and

writing the data into the database while assigning auto-increment IDs to the rows of data in the plurality of transactions.

10. The database processing apparatus according to claim 7 , wherein:

the database comprises a plurality of partitions, each partition of the plurality of partitions maintains auto-increment IDs that are independent from auto-increment IDs of other partitions; and

the set of instructions is executable by the one or more processors to cause the apparatus to further perform providing the plurality of transactions to a transaction queue corresponding to a partition where the plurality of transactions belong.

11. The database processing apparatus according to claim 7 , wherein, for generating auto-increment identifiers, the set of instructions is executable by the one or more processors to cause the apparatus to further perform:

for each transaction in the transaction queue, generating a batch of auto-increment IDs for the rows of data in the transaction according to system time and a number of data rows contained in the transaction.

12. The database processing apparatus according to claim 11 , wherein for the rows of data in each transaction in the transaction queue, a range of the generated auto-increment IDs is from one to the number of rows of data contained in the transaction, plus a greater one of the following two numerical values: the value of the auto-increment ID generated last time, and the system time.

13. A non-transitory computer readable medium that stores a set of instructions that is executable by at least one processor of an electronic device to cause the electronic device to perform a database processing method, the method comprising:

providing a plurality of transactions to a transaction queue, wherein each transaction of the plurality of transactions includes one or more rows of data to be written into a database;

generating auto-increment identifiers (IDs) for each row in each of the plurality of transactions according to an order of the transactions in the transaction queue, wherein a last ID of a last data row of a first transaction is assigned a lower ID than a first ID of a first row of a second transaction, wherein the second transaction is later in the transaction queue than the first transaction; and

writing the rows of data into the database according to the auto-increment IDs assigned to the rows of the data corresponding to the plurality of transactions, whereby the rows of data are assigned IDs in an order corresponding to an order of the transactions in the transaction queue.

14. The non-transitory computer readable medium according to claim 13 , wherein

an auto-increment ID for each data row of a precedent transaction in the transaction queue is less than an auto-increment ID for each data row of a later transaction in the transaction queue; and

when one transaction contains a plurality of rows of data, the auto-increment ID of a precedent data row in the transaction is less than the auto-increment ID of a later data row in the transaction.

15. The non-transitory computer readable medium according to claim 13 , wherein the set of instructions is executable by the at least one processor of the electronic device to cause the electronic device to further perform:

writing log data corresponding to the plurality of transactions in the transaction queue in a log, the log data comprising the auto-increment IDs of the rows of data in the corresponding plurality of transactions;

submitting the plurality of transactions corresponding to the log data in the log; and

writing the data into the database while assigning auto-increment IDs to the rows of data in the plurality of transactions.

16. The non-transitory computer readable medium according to claim 13 , wherein

the database comprises a plurality of partitions, each partition of the plurality of partitions maintains auto-increment IDs that are independent from auto-increment IDs of other partitions; and

the set of instructions is executable by the at least one processor of the electronic device to cause the electronic device to further perform:

providing the plurality of transactions to a transaction queue corresponding to a partition where the transactions of the plurality of transactions belong.

17. The non-transitory computer readable medium according to claim 13 , wherein the set of instructions is executable by the at least one processor of the electronic device to cause the electronic device to further perform:

for each transaction in the transaction queue, generating a batch of auto-increment IDs for the rows of data in the transaction according to system time and a number of data rows contained in the transaction.

18. The non-transitory computer readable medium according to claim 17 , wherein:

for the rows of data in each transaction in the transaction queue, a range of the generated auto-increment IDs is from one to the number of rows of data contained in the transaction, plus a greater one of the following two numerical values: the value of the auto-increment ID generated last time, and the system time.

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Apr 21, 2026
From: ALIBABA GROUP HOLDING LIMITED
To: CLOUD INTELLIGENCE ASSETS HOLDING (SINGAPORE) PRIVATE LIMITED
Reel/Frame 075478/0225 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Aug 11, 2020
From: YANG, LIAN; JIANG, SHAOQIANG; YANG, SHIQUAN
To: ALIBABA GROUP HOLDING LIMITED
Reel/Frame 053463/0228 →
Priority Claims (1)
CN 201610884605.0 · Oct 10, 2016 · national
Continuity (1)
Related Publication 20180101563A1 · Apr 12, 2018