Eureka AIR delivers breakthrough ideas for toughest innovation challenges, trusted by R&D personnel around the world.

A database primary key generation method suitable for distributed system

A distributed system and database technology, applied in database distribution/replication, electronic digital data processing, structured data retrieval, etc., can solve problems such as primary key conflicts, and achieve the effect of solving database primary key duplication and improving query efficiency.

Inactive Publication Date: 2019-01-18
SICHUAN UNIV
View PDF4 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0005] The invention provides a database primary key generation method suitable for distributed systems, which can effectively solve the problem of primary key conflicts in traditional distributed systems

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • A database primary key generation method suitable for distributed system
  • A database primary key generation method suitable for distributed system

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0014] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention more clear, clear and unambiguous, the embodiments of the present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present invention, not to limit the present invention.

[0015] Such as figure 1 As shown, the present invention is a method for generating a database primary key applicable to a distributed system, and is characterized in that it mainly includes the following steps:

[0016] (1) When each independent terminal of the distributed system inserts into the database, the current timestamp is generated;

[0017] (2) In order to avoid primary key conflicts, the sequence number of this operation is generated by the program;

[0018] (3) Concatenate the timestamp and serial number to generate a n...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention provides a database primary key generation method suitable for a distributed system, which belongs to the technical field of computer application and solves the problem of primary key conflict of a traditional distributed system. Because the traditional distributed system has multiple terminals, each independent terminal transaction may operate the database at the same time, which iseasy to cause database primary key conflict. To solve this problem, the sequence number and timestamp mechanism are used to avoid primary key collision. Specifically: when the terminal of the distributed system needs to insert data into the database, the current timestamp is generated first, then the timestamp is stitched with the sequence number generated by the program, and finally the primarykey of the database is formed. Because the sequence number is unique, it ensures that the primary key inserted into the database is also unique. The invention can effectively solve the primary key conflict problem caused by the transaction operation of the distributed system, and ensures the uniqueness of the primary key in the database. Compared with the existing method, it is simple and efficient.

Description

technical field [0001] The invention relates to the field of computer application technology, in particular to a method for generating a database primary key suitable for a distributed system. Background technique [0002] When designing a distributed system, when multiple terminals in the distributed system simultaneously add more data items, a data item operation primary key conflict will occur. At this time, the uniqueness of the database primary key is broken, causing obstacles to subsequent operations such as query. [0003] The current mainstream database primary key generation methods are mainly auto-increment strategy and UUID primary key generation strategy. The auto-increment strategy generates integer-type primary keys incrementally, but this method is not suitable for distributed systems. The UUID primary key generation strategy can effectively guarantee the global uniqueness of the primary key of each data item generated by the new data item operation, but UUID...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
IPC IPC(8): G06F16/27G06F16/2455
Inventor 王明辉刘运王跃徐子惠孔德仕
Owner SICHUAN UNIV
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Eureka Blog
Learn More
PatSnap group products