Solved

Postgres text vs character varying(256) (performance question)

Posted on 2011-03-03
2
1,358 Views
Last Modified: 2012-08-14
Hi Experts,

I'm wondering what kind of performance hit I'm going to take with queries if I use the text type rather than character varying.  I have a table that stores my data with each field in a record in a row, rather than in its own column.  There are about 500 fields per record (sparsely filled in).  I identify the type of data with a type column and depending on the type, it's either an int, double or text.  That text is too short in some cases (for note fields).  I can think of 3 choices I have (or please tell me if there's something I'm not thinking of!)
1-  Add a text column (in addition to the character varying column).  For most rows, it will be null
2-  Change the character varying column to a text column.  All 500 or so fields will be of type text instead of most as character varying and some text.  (note that both columns are always on every row anyway).
3-  Add a whole new table for fields of type text (I know this is probably the best, but I really don't want to do this)...

Thanks!
Mike
0
Comment
Question by:thready
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 40

Accepted Solution

by:
lcohan earned 500 total points
ID: 35031157
In order of best perfromance to worse 3,2 and I won't do 1 unless you can't afford the down time to alter your table columns.
0
 
LVL 1

Author Closing Comment

by:thready
ID: 35037065
thanks
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Best database to use for Maps is PostgreSQL. This is an open source database. Comes as a package with most Linux OS. For more info visit the following site: http://www.postgresql.org/ (http://www.postgresql.org/) This requires some add-o…
Many developers have database experience, but are new to PostgreSQL. It has some truly inspiring capabilities. I have several years' experience with Microsoft's SQL Server. When I began working with MySQL, I wanted a quick-reference to MySQL (htt…
Steps to create a PostgreSQL RDS instance in the Amazon cloud. We will cover some of the default settings and show how to connect to the instance once it is up and running.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question