0

I want to store an unique ID in my MySQL databse, but I need to know how long the X in varchar(X) should be.

The character length I need is 36 characters, example of an unique ID I use: 883db600-3512-4124-8cd5-5bd051f137fe

André Mathisen
  • 904
  • 2
  • 7
  • 15
  • It seems you're using UUID, so I would use `CHAR(36)` because the length will not change and you'd be storing that data together with the rest of your row data which should improve the performance. – Ja͢ck Jan 28 '15 at 14:10

2 Answers2

1

If it is always 36 characters long then use

char(36)

if it can be shorther then

varchar(36)
juergen d
  • 201,996
  • 37
  • 293
  • 362
0

A typical guid is 38 bytes (if you are counting the curlies).

More info: How many characters are there in a GUID?

char(38) or char(36)

Community
  • 1
  • 1
T McKeown
  • 12,971
  • 1
  • 25
  • 32