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

anzure
  • 824
  • 2
  • 7
  • 14
  • 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
  • 195,137
  • 36
  • 275
  • 343
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,786
  • 1
  • 24
  • 32