MySQL Forums
Forum List  »  Performance

Re: text vs varchar
Posted by: hua kai
Date: May 02, 2016 08:02PM

Øystein Grøvlen, Rick

Thank you very much for your answer

So here is my conclusion for (innodb):

1. At storage level, they are same, Short values will be stored on same page as rest of row, long values will be stored on separate pages.

2. When fetching data from INNODB(no temporary table considered), the server will allocate memory for VARCHAR even if they are not read in select sql, but TEXT will not. So it's better to use TEXT instead of VARCHAR if defined in a same table, or if you want to use VARCHAR which is seldom used, it's better to define in a separated table

3. When temporary table case, VARCHAR(n) when n < 512, could use tmp table in memory. n > 512 or text, it can not use memory, will create tmp table on disk

Am I correct?

Options: ReplyQuote


Subject
Views
Written By
Posted
2659
April 28, 2016 08:36AM
2371
April 29, 2016 12:41AM
1671
April 30, 2016 11:51PM
1539
May 02, 2016 04:37AM
1374
May 02, 2016 09:14PM
1463
May 03, 2016 02:19AM
2478
May 03, 2016 04:12AM
Re: text vs varchar
1399
May 02, 2016 08:02PM
1636
May 03, 2016 02:25AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.