Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2011-03-03
2
Medium Priority
?
1,393 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 2000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

636 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