pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Emi Lu <emilu@encs.concordia.ca>
To: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: char(N), varchar(N), varchar, text
Date: Wed, 08 Oct 2014 10:22:44 -0400
Message-ID: <543548B4.4060700@encs.concordia.ca> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <small>Good morning, <br>
      <br>
      For performance point of view, are there big differences between:
      char(N), varchar(N), varchar, text? <br>
    </small>
    <p><small>Some comments from google shows: <br>
        No difference, under the hood it's all varlena. Check this
        article from Depesz: <a
href="http://www.depesz.com/index.php/2010/03/02/charx-vs-varcharx-vs-varchar-vs-text/">http://www....;
        A couple of highlights:</small></p>
    <small>
    </small>
    <blockquote><small> </small>
      <p><small>To sum it all up:</small></p>
      <small> </small>
      <ul>
        <li><small>char(n) &#8211; takes too much space when dealing with
            values shorter than n, and can lead to subtle errors because
            of adding trailing spaces, plus it is problematic to change
            the limit</small></li>
        <li><small>varchar(n) &#8211; it's problematic to change the limit in
            live environment</small></li>
        <li><small>varchar &#8211; just like text</small></li>
        <li><small>text &#8211; for me a winner &#8211; over (n) data types because
            it lacks their problems, and over varchar &#8211; because it has
            distinct name</small></li>
      </ul>
      <small>
        So, can I assume no big performance differences? <br>
        Thanks alot!<br>
        Emi<br>
      </small></blockquote>
  </body>
</html>




view thread (3+ messages)  latest in thread

Message-ID: <543548B4.4060700@encs.concordia.ca>
Permalink:  ../543548B4.4060700@encs.concordia.ca/
Also on:    postgresql.org/message-id/543548B4.4060700@encs.concordia.ca

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: emilu@encs.concordia.ca
  Subject: Re: char(N), varchar(N), varchar, text
  In-Reply-To: <543548B4.4060700@encs.concordia.ca>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox