Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+6 votes
in Q2A Core by
edited by

Following up wiht the post


do you guys see any efficency or security concerns if I increase the allowable maximum size of question contents from 8,000 (as is) to 88,000 ?

--- added later---

Whe I practiced that in phpMyAdmin here is what happneded:

in practice the type changed to mediumtext!


related to an answer for: Change Answer 8000 limit

1 Answer

+4 votes
selected by
Best answer

Short answer: You can't. The limit of a VARCHAR is 65535. You could use fields in the TEXT data type family if you need such an amount. Assuming 65535 is ok for you I'll continue with the answer.

Now, 65535 might not be possible either because that value might exceed the maximum amount of size per table row too. This is the error you could get:

ERROR 1118 (42000): Row size too large. The maximum row size for the
used table type, not counting BLOBs, is 65535. You have to change some
columns to TEXT or BLOBs

So you should decrease that value until you succeed in the creation of the field.

Assuming you have finally found that number... there is no security issue to be concerned about, that's for sure.

Regarding efficency... I would advice you to reach to an answer yourself empirically. I've been looking for an answer myself and I couldn't find it. Documentation says nothing about it so everything points to the fact that there is no performance decrement... except this post: http://stackoverflow.com/a/205472/268273

I've found that answer many times in SO but always that user mentioned that. If it is true or not I don't know and, as you can see, the origin seems to be nothing but gossip. Best thing you can do is give it a try :)

Benchmark on VARCHAR vs. TEXT: http://stackoverflow.com/a/24156661/1066234

I remember having the same issue, someone warned me about updates that might set varchar=8000 again, which would kill your content.
Thank you Kai,
In practice I could increase the content size to 20,000. So how did you solve your issue?
It will definitely be better to stick with VARCHAR. Running updates when saving more than 8k characters on that field will obviously take more time than just saving 8k. However, saving 8k or less in that field should take the same time, regardless of the max size. What I mean is: you don't save the full size of a VARCHAR (that happens with the CHAR only).

Anyway, if it takes a few extra milliseconds when running an update but you're allowing them to store more data, nobody will complain about it.

Regarding TEXT it makes sense it takes more time... I wouldn't have expected it to take 3 times what it takes with a VARCHAR but probably that would depend on the query run.
@Waterfr Villa: I sticked to Varchar(8000) and am forcing my users now (few that post long text), to split the text in two parts (one in question, one in comment) OR (one in question, one in anohter question).