Ask a Question related to PostgreSQL / PGSQL, Design and Development.

  1. #1

    Default varchar vs text

    Are there any differences between text and varchar? I found the following in
    the docs, which leads me to believe that there are no differences at all.
    Can someone please confirm this before I switch all my varchars to text?

    Tip: There are no performance differences between these three types, apart
    from the increased storage size when using the blank-padded type. While
    character(n) has performance advantages in some other database systems, it
    has no such advantages in PostgreSQL. In most situations text or character
    varying should be used instead.


    Sim Zacks Guest

  2. Similar Questions and Discussions

    1. text and varchar
      Hello, sorry for the trivial question. Is there any difference between varchar and text types in practice? I couldn't find. Mage ...
    2. Question about varchar and text
      What is the difference between varchar and text? I have heard that you can use text instead of varchar and this could speed up your tables. ...
    3. VARCHAR or not ?
      Solaris 8 IDS 7.31 FD3 We have to create a table, that will contain a code, a short description and then a long description (up to 2000...
    4. cast problem -- int to varchar
      Hello, I have the following cross tab query...I need to convert the EmployeeStatus from an int to a varchar datatype so I can describe the result...
    5. Conversion of Varbinary into varchar
      Dear All, I have written a stored procedure which returns a Varbinary column from MS SQl Server 7 database. I tried converting the same into...
  3. #2

    Default Re: varchar vs text

    On Tue, Jan 04, 2005 at 09:50:18AM +0200, Sim Zacks wrote:
    > Are there any differences between text and varchar? I found the followingin
    > the docs, which leads me to believe that there are no differences at all.
    > Can someone please confirm this before I switch all my varchars to text?
    Correct. The only difference between varchar and text is that varchar
    can have a maximum length, which will be checked. As for storage used,
    indexability, operators, etc they're identical.

    Hope this helps,
    --
    Martijn van Oosterhout <kleptog@svana.org> [url]http://svana.org/kleptog/[/url]
    > Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
    > tool for doing 5% of the work and then sitting around waiting for someone
    > else to do the other 95% so you can sue them.
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.0.6 (GNU/Linux)
    Comment: For info see [url]http://www.gnupg.org[/url]

    iD8DBQFB3C4XY5Twig3Ge+YRAoyNAKCrU/oBnFNgN65tQ6X9KJ/UrSlwowCeJLyP
    NyGjrUAcZM9wO8uH0r85zM0=
    =MUxM
    -----END PGP SIGNATURE-----

    Martijn van Oosterhout Guest

  4. #3

    Default Varchar VS Text

    Hi,

    Some people said that using Text as datatype is preferred and there is
    no reason to use Varchar. Their claimed that that by using Text, no
    length checking is needed as varchar, so the performance of using Text
    is generally faster.

    Anyone did the test before?

    Thnaks for any comments.

    howachen@gmail.com Guest

  5. #4

    Default Re: Varchar VS Text

    [email]howachen@gmail.com[/email] wrote:
    >
    > Some people said
    Who is "some people"? Some people may be stupid ;-)
    > that using Text as datatype is preferred and there is
    > no reason to use Varchar. Their claimed that that by using Text, no
    > length checking is needed as varchar, so the performance of using Text
    > is generally faster.
    VARCHAR and TEXT types differ in some points. Read it here:
    [url]http://dev.mysql.com/doc/refman/5.0/en/blob.html[/url]

    The "length checking" argument is questionable, TEXT columns have
    a length restriction too. I also doubt the performance argument
    (but never measured this). BLOB and TEXT data is stored separately
    from other row data so you have less locality on the storage when
    accessing BLOB/TEXT data. So I would expect worse performance.


    XL
    --
    Axel Schwenke, Senior Software Developer, MySQL AB

    Online User Manual: [url]http://dev.mysql.com/doc/refman/5.0/en/[/url]
    MySQL User Forums: [url]http://forums.mysql.com/[/url]
    Axel Schwenke Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139