Database primary key generation method and device, electronic equipment and storage medium

A database, data technology, applied in the field of distributed data processing and database, can solve problems such as duplication

Pending Publication Date: 2022-07-01
MAIPU COMM TECH CO LTD
View PDF0 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0004] The purpose of the embodiment of the present application is to provide a method, device, electronic device and storage medium for generating a database primary key, which is used to improve the problem that the generated primary key is likely to be duplicated with the generated primary key when the system clock is dialed back

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
  • Database primary key generation method and device, electronic equipment and storage medium
  • Database primary key generation method and device, electronic equipment and storage medium
  • Database primary key generation method and device, electronic equipment and storage medium

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0020] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application.

[0021] Before introducing the database primary key generation method provided by the embodiments of the present application, some concepts involved in the embodiments of the present application are first introduced:

[0022] 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.

[0023] It should be noted that the method for generating a database primary key provided by the embodiments of the present application can be executed by an electronic device, and the electronic device here refers...

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 and device, electronic equipment and a storage medium, and the method comprises the steps: determining an index position of a primary key of to-be-generated data in a circular array according to the current system time of a server where the database is located when the database needs to add a piece of data, and if the content on the index position is null, generating a primary key of the to-be-generated data; if yes, generating a primary key of the data according to a set algorithm, storing the primary key in an index position, and storing the primary key as the data in a database; otherwise, acquiring the primary key stored last time from the index position in the circular array, and extracting the timestamp, the machine identifier and the sequence identifier in the primary key; and if the current system time is less than the timestamp in the last stored primary key, generating a new primary key according to the timestamp in the last stored primary key, the machine identifier and the self-increased sequence identifier, then storing the new primary key in the index position of the cyclic array, and storing the new primary key as data into the primary key of the database.

Description

technical field [0001] The present application relates to the technical field of distributed data processing and databases, and in particular, to a method, apparatus, electronic device and storage medium for generating a primary key of a database. Background technique [0002] The primary key (identification, ID), also known as the primary key symbol, refers to an identifier that identifies the target object in the computer system. The target object is a file as an example. The primary key of a file can be the file path and file name, but when the file path Or when the file name changes, it is difficult to obtain the file based on the original primary key. Therefore, the self-incrementing primary key generated by the database can usually be used as the primary key of the file. [0003] At present, the self-incrementing identification of traditional databases is mostly used to identify a large amount of data and messages, but this method is not suitable for complex distribute...

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
Patent Type & Authority Applications(China)
IPC IPC(8): G06F16/22G06F16/182
CPCG06F16/2228G06F16/2282G06F16/182
Inventor 杨斌
Owner MAIPU COMM TECH CO LTD
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
Try Eureka
PatSnap group products