Use of the Postgresql uuid.

Source: Internet
Author: User
Tags postgresql uuid

PostgreSQL built-in UUID type, performance is good, but PostgreSQL by default does not install UUID related operation function, need to manually import.

Import UUID-related functions.

psql-d dbname-u dbuser-f D:/develop/database/postgresql/9.3/share/contrib/uuid-ossp.sql

Defines the UUID as the primary key and automatically generates the primary key

reate TABLE data_2014.test (uid uuid not NULL DEFAULT uuid_generate_v1 (), name character varying (+), CONSTRAINT test_p Key PRIMARY key (UID)) with (Oids=false);

The UUID function is built into Java, and when the data volume is large, there have been duplicate keys, causing the system to malfunction.

Java.util.UUID.randomUUID (). toString ();

In addition, you can use Com.eaio.uuid.UUID

New Com.eaio.uuid.UUID (). toString ();


Use of the Postgresql uuid.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.