5
What kind of data to use to store Uris in the database, taking into account an indeterminate or very large URI length?
5
What kind of data to use to store Uris in the database, taking into account an indeterminate or very large URI length?
7
If you consider that Urls do not usually exceed 2K in size and that the VARCHAR
in Mysql supports up to 65535 characters (the line also has this limit, so in practice it has to be a little smaller. This gives with leftovers.
In theory a URL can be larger, so if you want to guarantee it would be interesting to use a MEDIUMTEXT
(16MB) or LONGTEXT
(4GB). But I think a big nonsense, I would go to VARCHAR
even, until it’s proven that you need something bigger.
Obviously I discard any type that is not text, at least in Mysql.
More details on What types of data exist in Mysql for text?.
The question originally spoke in URL and then changed to URI. It is still worth the same. It is more likely to pass the size of a URI VARCHAR
, but depending on how the URI is composed the best solution would be another.
Browser other questions tagged mysql database typing
You are not signed in. Login or sign up in order to post.
Urls that pass 2K do not have much guarantee that they will work, except in applications specifically written thinking about it. RFC recommences at least 8K support, but until the IE10, it was not possible to pass the 2K in the address bar. More details here: http://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers - I would suggest thinking about what your application will actually need, limit the value and document correctly.
– Bacco
Related: http://answall.com/q/43224/101
– Maniero
A good doubt Vinicius +1
– Guilherme Nascimento
This answers your question? Store data in the database using PDO::commit
– Gonçalo
@Gonçalo the questions have no relation, could check if indicated the right link?
– Woss