开发者

Limiting the size of TEXT in MySQL for speed

I have a table with a field that needs to store 512 characters. My question is this: can you limit the length of a TEXT field (VARCHAR stops at 255 - I can't use it) to 512 characters? If I do that, will MySQL run through the table quicker due to the fixed data length, or does it act a bit like VARCHAR in that the length can vary?

I don't have a table (at all) yet, but I'm very conscious about speed and开发者_如何学Python size for the future. I found this article: link text incredibly useful - maybe you will to!

Thanks a lot,

James


Update your mysql server. Since 5.0.3 you can store up to 65535 bytes in VARCHAR.


You don't really say how you are using the table, so I'll just throw this in. One option is to separate out the text field into another table and just have a reference to it in your original table.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜