I need to store a URL in one of my tables. Problem is, I don't know and can't assume its length.
I would like to know what variable type should I use (I was thinking about
Modern versions of MySQL support very long
VARCHAR strings, so you can try with something like
VARCHAR(2048) or use a
TEXT field if you're concerned they could be even longer, that allows up to 64K characters.
Although there are historical reasons for keeping URLs relatively short, tradition holds they should be under 1500 characters, it's not uncommon to see some sites wildly exceed this. That being said, 64K should suffice and anything longer than that is a severe outlier.