Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Method and system for generating main key of distributed database

A technology for generating systems and databases, applied in the field of distributed databases, can solve the problem of limited length of primary keys, and achieve the effect of efficient concurrent performance

Inactive Publication Date: 2017-10-13
PHICOMM (SHANGHAI) CO LTD
View PDF2 Cites 14 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0009] The technical problem to be solved by the present invention is to provide a distributed database primary key generation method and system to solve the problem that the primary key generated by the existing distributed database has a limited length

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
  • Method and system for generating main key of distributed database
  • Method and system for generating main key of distributed database
  • Method and system for generating main key of distributed database

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0044] This embodiment provides a method for generating a distributed database primary key, such as figure 1 shown, including steps:

[0045] S11: Receive a primary key generation request;

[0046] S12: Generate a unique primary key according to the primary key generation request; the primary key consists of a seed part and an auto-growth part.

[0047] A database is a warehouse that organizes, stores and manages data according to its data structure. Databases include distributed databases, which differ from single databases in that:

[0048] A distributed database is a logically unified database composed of multiple physically dispersed database units connected by a computer network. Each connected database unit is called a site or node. Distributed databases are managed by a unified database management system, which is called a distributed database management system.

[0049] In a database software system, it is necessary to generate a unique string of numbers or charac...

Embodiment 2

[0089] This embodiment provides a method for generating a distributed database primary key, such as figure 2 shown, including steps:

[0090] S21: Receive a primary key generation request;

[0091] S22: generating a nine-base number;

[0092] S23: Query whether the non-nary number exists in the database, if so, regenerate a non-nary number, otherwise, assign the non-nary number to the seed part of the primary key;

[0093] S24: saving the nine-ary number to the database;

[0094] S25: Generate the self-growth part of the primary key.

[0095] The difference between this embodiment and the first embodiment is that the step of generating the seed part of the primary key specifically includes step S22, step S23, and step S24.

[0096] In this embodiment, the seed part is a nine-digit number generated by a central server.

[0097] Specifically, the central server first generates decimal numbers, and then converts them into nine-ary numbers.

[0098] The seed part is fixed u...

Embodiment 3

[0119] This embodiment provides a method for generating a distributed database primary key, such as image 3 shown, including steps:

[0120] S31: Receive a primary key generation request;

[0121] S32: generating a nine-base number;

[0122] S33: Query whether the non-ary number exists in the database, if so, regenerate a non-ary number, otherwise, assign the non-ary number to the seed part of the primary key;

[0123] S34: saving the nine-ary number to the database;

[0124] S35: Store the non-nary number whose initial value is zero in the database corresponding to the seed part;

[0125] S36: Increase the value of the self-increasing part sequentially according to the order of increasing records.

[0126] The difference between this embodiment and the first and second embodiments is that the step of generating the self-incrementing part of the primary key specifically includes step S35 and step S36.

[0127] The self-growth part of the primary key is also a string of 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 method and system for generating a main key of a distributed database and aims to solve the problem that the main key word length generated by an existing distributed database is limited. The method comprises the steps that (S1) a main key generation request is received; and (S2) a unique main key is generated according to the main key generation request, wherein the main key is composed of a seed part and a self-growth part. Through use of the method and system provided by the invention, global uniqueness, single database continuous distribution and efficient concurrence performance of the main key can be satisfied at the same time; and the word length of the generated main key is not limited.

Description

technical field [0001] The invention relates to the field of distributed databases, in particular to a method and system for generating a primary key of a distributed database. Background technique [0002] In a database software system, it is necessary to generate a unique string of numbers or character strings within the scope of the database as the identification number (ID) of a record in the database, that is, the primary key in database terms. In a stand-alone database, the primary key ID is often generated directly using the database auto-increment feature. This method is easy to operate and easy to use. [0003] In a distributed database environment, data is distributed on different databases and cannot be directly generated by using the self-growth feature of each database. Otherwise, the primary keys of data tables on different shards will be duplicated. [0004] In addition to the requirement for the primary key of the database to be globally unique, it is also r...

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): G06F17/30
CPCG06F16/2228G06F16/2282
Inventor 仇亚东
Owner PHICOMM (SHANGHAI) CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products