MySQL: Large VARCHAR vs. TEXT?

后端 未结 8 1410
庸人自扰
庸人自扰 2020-11-22 09:21

I\'ve got a messages table in MySQL which records messages between users. Apart from the typical ids and message types (all integer types) I need to save the actual message

8条回答
  •  眼角桃花
    2020-11-22 10:00

    Disclaimer: I'm not a MySQL expert ... but this is my understanding of the issues.

    I think TEXT is stored outside the mysql row, while I think VARCHAR is stored as part of the row. There is a maximum row length for mysql rows .. so you can limit how much other data you can store in a row by using the VARCHAR.

    Also due to VARCHAR forming part of the row, I suspect that queries looking at that field will be slightly faster than those using a TEXT chunk.

提交回复
热议问题