Reputation: 63636
I've been using varchar(300)
,but I've also noticed longer urls.
Upvotes: 4
Views: 6653
Reputation: 677
As of now:
<< MySQL 5.0.3 use TEXT
or
>= MySQL 5.0.3 use VARCHAR(2083)
Upvotes: 2
Reputation: 455020
Technically HTTP does not put a limit on the max length of a URL. Read this SO post.
So varchar
will not be of help, You'll have to use TEXT
Upvotes: 3
Reputation: 816404
As you can see here, browsers can handle different URL lengths (and very long). So you should consider using text
as data type.
Upvotes: 1
Reputation: 425361
Use TEXT
, it's enough for every URL
.
Note that with long URL
s, you won't be able to create an index that covers the whole URL
. If you need a UNIQUE
index, you should calculate the URL
hash, store the hash separately and index the hash instead.
Upvotes: 9