<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: TEXT vs. VARCHAR</title>
	<atom:link href="http://www.pythian.com/news/7129/text-vs-varchar/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pythian.com/news/7129/text-vs-varchar/</link>
	<description>News and views from Pythian DBAs</description>
	<lastBuildDate>Fri, 10 Feb 2012 13:01:25 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
	<item>
		<title>By: Nate Haug</title>
		<link>http://www.pythian.com/news/7129/text-vs-varchar/#comment-648253</link>
		<dc:creator>Nate Haug</dc:creator>
		<pubDate>Thu, 24 Nov 2011 02:06:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.pythian.com/news/?p=7129#comment-648253</guid>
		<description>&lt;blockquote&gt;
If the VARCHAR is the only row in the table, and does not allow NULL values, the maximum length allowed for VARCHAR is 65,532 bytes.
&lt;/blockquote&gt;

This sentence is incorrect. It should be &quot;If the VARCHAR is the only COLUMN in the table&quot;, not &quot;row&quot;. If you have multiple varchar columns, you should assume 65,532/(varchar columns) max per row.</description>
		<content:encoded><![CDATA[<blockquote><p>
If the VARCHAR is the only row in the table, and does not allow NULL values, the maximum length allowed for VARCHAR is 65,532 bytes.
</p></blockquote>
<p>This sentence is incorrect. It should be &#8220;If the VARCHAR is the only COLUMN in the table&#8221;, not &#8220;row&#8221;. If you have multiple varchar columns, you should assume 65,532/(varchar columns) max per row.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: khalid mahmood</title>
		<link>http://www.pythian.com/news/7129/text-vs-varchar/#comment-626167</link>
		<dc:creator>khalid mahmood</dc:creator>
		<pubDate>Mon, 31 Oct 2011 10:21:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.pythian.com/news/?p=7129#comment-626167</guid>
		<description>So what about storing texts like abstracts or mails, that have 10 000 to 30 000 characters. Should one use VARCHAR(30000) or TEXT ? The most important thing for me is performance, full-text search performance. What column type would be faster? For example i have the ‘articles’ table, with columns: title (1000 chars), abstract (30000 chars), and i want to quickly find particular article(s) in a table like 20 000 000 rows using full-text search.</description>
		<content:encoded><![CDATA[<p>So what about storing texts like abstracts or mails, that have 10 000 to 30 000 characters. Should one use VARCHAR(30000) or TEXT ? The most important thing for me is performance, full-text search performance. What column type would be faster? For example i have the ‘articles’ table, with columns: title (1000 chars), abstract (30000 chars), and i want to quickly find particular article(s) in a table like 20 000 000 rows using full-text search.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: OnLine</title>
		<link>http://www.pythian.com/news/7129/text-vs-varchar/#comment-625655</link>
		<dc:creator>OnLine</dc:creator>
		<pubDate>Sun, 30 Oct 2011 16:32:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.pythian.com/news/?p=7129#comment-625655</guid>
		<description>Hi,
From what i read on other websites, TINYTEXT uses less memory, but in long run request can fragment it.
&#039;i don&#039;t know if its something better.</description>
		<content:encoded><![CDATA[<p>Hi,<br />
From what i read on other websites, TINYTEXT uses less memory, but in long run request can fragment it.<br />
&#8216;i don&#8217;t know if its something better.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: xerxes</title>
		<link>http://www.pythian.com/news/7129/text-vs-varchar/#comment-515521</link>
		<dc:creator>xerxes</dc:creator>
		<pubDate>Mon, 28 Feb 2011 14:14:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.pythian.com/news/?p=7129#comment-515521</guid>
		<description>Since MEMORY engine (think temp tables) maps variable-width types as appropriate fixed-width counterparts, those are obliviously padded to the maximum width of the original column. Does using NULL effectively rule out padding for specific rows thus saving memory or the value still gets padded *with* the flag included?

I assume no padding occurs in case of NULL, and that&#039;s why DEFAULT &#039;&#039; on variable-width types is generally considered bad practice. Am I correct?</description>
		<content:encoded><![CDATA[<p>Since MEMORY engine (think temp tables) maps variable-width types as appropriate fixed-width counterparts, those are obliviously padded to the maximum width of the original column. Does using NULL effectively rule out padding for specific rows thus saving memory or the value still gets padded *with* the flag included?</p>
<p>I assume no padding occurs in case of NULL, and that&#8217;s why DEFAULT &#8221; on variable-width types is generally considered bad practice. Am I correct?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sheeri Cabral</title>
		<link>http://www.pythian.com/news/7129/text-vs-varchar/#comment-435907</link>
		<dc:creator>Sheeri Cabral</dc:creator>
		<pubDate>Mon, 14 Jun 2010 18:18:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.pythian.com/news/?p=7129#comment-435907</guid>
		<description>Michael -- the &quot;Conclusions&quot; section of the blog post should be pretty clear about that.  

&lt;I&gt;Conclusions
Because of the storage implications, it is preferable to use VARCHAR instead of TINYTEXT.&lt;/I&gt;

Of course, that&#039;s if that&#039;s possible, you may run into other size limitations (such as row size, or size if you are using a multi-byte character set).

&lt;I&gt;Make sure you are aware of the effects of a multi-byte character set. VARCHAR(255) stores 255 characters, which may be more than 255 bytes.&lt;/I&gt;

I will also add that the answer to &quot;would there be an overall performance benefit&quot; is almost always &quot;I can tell you for a general case but the best way to do it would be to get benchmarks for a system with load, then try the change out and take benchmarks again.&quot;  I cannot stress having a testing environment enough in these cases.

That being said, I would expect better performance with VARCHAR than with TINYTEXT.  However, depending on what you&#039;re doing, the best solution might be something completely different, such as having a different storage engine or putting the text in a different application.  (MySQL&#039;s FULLTEXT search isn&#039;t as good as other solutions such as Sphinx and Lucene)</description>
		<content:encoded><![CDATA[<p>Michael &#8212; the &#8220;Conclusions&#8221; section of the blog post should be pretty clear about that.  </p>
<p><i>Conclusions<br />
Because of the storage implications, it is preferable to use VARCHAR instead of TINYTEXT.</i></p>
<p>Of course, that&#8217;s if that&#8217;s possible, you may run into other size limitations (such as row size, or size if you are using a multi-byte character set).</p>
<p><i>Make sure you are aware of the effects of a multi-byte character set. VARCHAR(255) stores 255 characters, which may be more than 255 bytes.</i></p>
<p>I will also add that the answer to &#8220;would there be an overall performance benefit&#8221; is almost always &#8220;I can tell you for a general case but the best way to do it would be to get benchmarks for a system with load, then try the change out and take benchmarks again.&#8221;  I cannot stress having a testing environment enough in these cases.</p>
<p>That being said, I would expect better performance with VARCHAR than with TINYTEXT.  However, depending on what you&#8217;re doing, the best solution might be something completely different, such as having a different storage engine or putting the text in a different application.  (MySQL&#8217;s FULLTEXT search isn&#8217;t as good as other solutions such as Sphinx and Lucene)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Oleksak</title>
		<link>http://www.pythian.com/news/7129/text-vs-varchar/#comment-435893</link>
		<dc:creator>Michael Oleksak</dc:creator>
		<pubDate>Mon, 14 Jun 2010 17:08:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.pythian.com/news/?p=7129#comment-435893</guid>
		<description>Thank you Sheeri, I thought about it right after I typed it.  What is your opinion on setting the VARCHAR size to 30000 - which in our case should suffice, considering the number of characters being input to that particular field?

Would there be an overall performance benefit?</description>
		<content:encoded><![CDATA[<p>Thank you Sheeri, I thought about it right after I typed it.  What is your opinion on setting the VARCHAR size to 30000 &#8211; which in our case should suffice, considering the number of characters being input to that particular field?</p>
<p>Would there be an overall performance benefit?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sheeri Cabral</title>
		<link>http://www.pythian.com/news/7129/text-vs-varchar/#comment-435855</link>
		<dc:creator>Sheeri Cabral</dc:creator>
		<pubDate>Mon, 14 Jun 2010 12:38:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.pythian.com/news/?p=7129#comment-435855</guid>
		<description>Michael,

You cannot create a varchar field with no size declaration.</description>
		<content:encoded><![CDATA[<p>Michael,</p>
<p>You cannot create a varchar field with no size declaration.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Oleksak</title>
		<link>http://www.pythian.com/news/7129/text-vs-varchar/#comment-435337</link>
		<dc:creator>Michael Oleksak</dc:creator>
		<pubDate>Sun, 13 Jun 2010 02:43:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.pythian.com/news/?p=7129#comment-435337</guid>
		<description>I have a table that contains a description field set as TEXT in which my clients enter descriptive text in the CMS.

It can contain regular text, and html markup.

My first consideration is to perform a vetical partition on the table so the description field is in a separate table, 

My question is, would I benefit (overall site performance ) by converting this field to varchar with no size declaration?</description>
		<content:encoded><![CDATA[<p>I have a table that contains a description field set as TEXT in which my clients enter descriptive text in the CMS.</p>
<p>It can contain regular text, and html markup.</p>
<p>My first consideration is to perform a vetical partition on the table so the description field is in a separate table, </p>
<p>My question is, would I benefit (overall site performance ) by converting this field to varchar with no size declaration?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sheeri Cabral</title>
		<link>http://www.pythian.com/news/7129/text-vs-varchar/#comment-424647</link>
		<dc:creator>Sheeri Cabral</dc:creator>
		<pubDate>Tue, 20 Apr 2010 17:36:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.pythian.com/news/?p=7129#comment-424647</guid>
		<description>I would use TEXT - the maximum theoretical size of varchar is 65,536 bytes and in practice it&#039;s shorter....so if you have VARCHAR(30000) and the character set is utf-8, you won&#039;t be able to create that column.  If you&#039;re using a character set that is 1 or 2 bytes per character, you can create it, but I wouldn&#039;t limit myself like that in case you want to convert in the future.

If you want fast fulltext search, using MySQL&#039;s FULLTEXT search is not the best tool -- consider using Sphinx or Lucene.</description>
		<content:encoded><![CDATA[<p>I would use TEXT &#8211; the maximum theoretical size of varchar is 65,536 bytes and in practice it&#8217;s shorter&#8230;.so if you have VARCHAR(30000) and the character set is utf-8, you won&#8217;t be able to create that column.  If you&#8217;re using a character set that is 1 or 2 bytes per character, you can create it, but I wouldn&#8217;t limit myself like that in case you want to convert in the future.</p>
<p>If you want fast fulltext search, using MySQL&#8217;s FULLTEXT search is not the best tool &#8212; consider using Sphinx or Lucene.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Janusz</title>
		<link>http://www.pythian.com/news/7129/text-vs-varchar/#comment-423463</link>
		<dc:creator>Janusz</dc:creator>
		<pubDate>Fri, 16 Apr 2010 11:35:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.pythian.com/news/?p=7129#comment-423463</guid>
		<description>So what about storing texts like abstracts or mails, that have 10 000 to 30 000 characters. Should one use VARCHAR(30000) or TEXT ? The most important thing for me is performance, full-text search performance. What column type would be faster? For example i have the &#039;articles&#039; table, with columns: title (1000 chars), abstract (30000 chars), and i want to quickly find particular article(s) in a table like 20 000 000 rows using full-text search.</description>
		<content:encoded><![CDATA[<p>So what about storing texts like abstracts or mails, that have 10 000 to 30 000 characters. Should one use VARCHAR(30000) or TEXT ? The most important thing for me is performance, full-text search performance. What column type would be faster? For example i have the &#8216;articles&#8217; table, with columns: title (1000 chars), abstract (30000 chars), and i want to quickly find particular article(s) in a table like 20 000 000 rows using full-text search.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

