Re: VARCHAR vs. TEXT - some performance numbers
There are reasons for VARCHAR(255) being better than TEXT. (Your test did not find one, as was pointed out.)
When a tmp table is needed for a SELECT, the first choice is to use MEMORY, which will be RAM-only, hence probably noticeably faster. (Second choice is MyISAM.) However, TEXT and BLOB are not allowed in MEMORY, so it can't use it. (There are other reasons why it might skip MEMORY.)
Note: I believe the above comment applies even for TINYTEXT, which is nearly identical to VARCHAR(255).
Prefix indexes are almost always bad for performance. And they have a gotcha -- In your example (with "PRIMARY KEY (a(255))"), you are enforcing that the first 255 bytes of 'a' are distinct. (Yes, that was quite ok for your test, but is usually 'wrong' in real life.)
VARCHAR(255) can hold 255 characters.
TINYTEXT can hold 255 bytes.
Note the subtle difference, especially when running with utf8. This means that the former may hold more stuff.
Subject
Views
Written By
Posted
246326
July 31, 2006 06:57AM
66288
July 31, 2006 07:51AM
39143
July 31, 2006 09:48AM
29227
June 16, 2009 01:12PM
Re: VARCHAR vs. TEXT - some performance numbers
31804
June 16, 2009 10:17PM
29852
June 16, 2009 10:25PM
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.