Performance test of int self-added sequence GUID
http://blog.csdn.net/fox123871/article/details/6578922
The test results show that the performance of the INT primary key does not significantly exceed the GUID primary key on the most commonly used insert deletion, and the advantage is less than 15%
Distributed with GUIDs, frequently migrated with GUIDs
Self-adding sequences for small local projects
You can either produce a UUID in a program to deposit a string, or you can automatically generate a UUID from the database
In fact, however, the Oracle database circles are accustomed to using UUID. Ensure that the generated IDs are not only table independent, but also library independent, which is especially important when you want to slice the database.
MySQL also natively supports the UUID select UUID (); the production UUID in the program is stored in a string
The UUID in Java is jdk1.5 adding a class Java.Util.UUID
UUID Uuid=uuid.randomuuid ();
String uuidstr=uuid.tostring (); such as: 9b17a4f1-cae4-42ce-9cba-b899dcac8517
uuid.fromstring (name)
Access to the database with varchar. database automatically generates UUID
Postgre UUID type contrib function and Pgcrypto module Gen_random_uuid () function
Postgre 8 supports UUID https://www.postgresql.org/docs/devel/static/uuid-ossp.html
Note:if you are need randomly-generated (version 4) UUIDs, consider using the Gen_random_uuid () function from the PGCRYP To module instead.
UUID-OSSP provides functions to generate universally unique identifiers (UUIDs) using one of several standard algorithms:
UUID_GENERATE_V1 ()
This function generates a version 1 UUID. This is involves the MAC address of the computer and a time stamp. Note which uuids of this kind reveal the identity of the computer which created the identifier and the time at which it did So, which might make it unsuitable for certain security-sensitive applications.
UUID_GENERATE_V1MC ()
This function generates a version 1 UUID but uses a random multicast MAC address instead of the "real MAC" address of the CO Mputer.
Uuid_generate_v3 (namespace uuid, name text)
This function generates a version 3 UUID in the given namespace using the specified input name. The namespace should is one of the special constants produced by the uuid_ns_* functions () shown in Table F-32. (It could is any UUID in theory.) The name is a identifier in the selected namespace.
For example:
SELECT Uuid_generate_v3 (Uuid_ns_url (), ' http://www.postgresql.org ');
The name parameter is md5-hashed, so the cleartext cannot is derived from the generated UUID. The generation of UUIDs by it has no random or environment-dependent element and is therefore reproducible.
UUID_GENERATE_V4 ()
This function generates a version 4 UUID, which are derived entirely from random numbers.
Uuid_generate_v5 (namespace uuid, name text)
This function generates the a version 5 UUID, which works like a version 3 UUID except that SHA-1 are used as a hashing method. Version 5 should be preferred over version 3 because SHA-1 are thought to being more secure than MD5.