Oracle UUID/GUID primary key and number primary key comparison

Source: Internet
Author: User

Number of records: 349408

Three tables: T2, T3, and T4

The ID of T2 is raw (16)

The ID of T3 is Char (32)

T4 ID is number

Other fields are the same (22 fields with ID ):

X1 number
X2 number
X3 varchar2 (500 byte)
X4 varchar2 (2000 byte)
X5 varchar2 (500 byte)
X6 number
X7 date
X8 varchar2 (2000 byte)
X9 number
X10 number (1, 0)
X11 number
X12 number
X13 varchar2 (50 byte)
X14 varchar2 (50 byte)
X15 varchar2 (2000 byte)
X16 varchar2 (256 byte)
X17 number (1, 0)
X18 varchar2 (2000 byte)
X19 varchar2 (4000 byte)
X20 number
X21 number

 

 

Test 1:

Select * From T2;

Select * from T3;

Select * From T4;

 

Result (unit: seconds)

1 2 3 4 5 6 Average
T2 12.71 10.05286 9.056 9.5318 9.077147 9.40745 9.972543
T3 9.309 9.9791 8.913 9.0849 9.789756 8.52539 9.266858
T4 8.9315 9.13159 8.873 9.0031 9.696671 8.8288 9.077444

 

Test 2:

Select count (*) from T2;

Select count (*) from T3;

Select count (*) from T4;

 

Result (unit: seconds)

1 2 3 4 Average
T2 2.703 2.766 3.5 2.813 2.9455
T3 2.844 2.938 2.922 2.875 2.89475
T4 2.375 2.813 2.344 2.953 2.62125

 

 

Conclusion:

Select full table, select count

Raw (16) has the worst performance

Char (32)

Best number

 

However, 2.62 and 2.94, 9.077 and 9.97 are not much different.

UUID must be used, so it can only be raw (16) or char (32). It seems that the select performance is acceptable.

It doesn't matter if the insert statement is slow or delete the statement.

Char (32), better readability, and easier programming

Raw (16) I think it takes half of char (32) space.

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.