Solved

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

Posted on 2011-03-03
2
1,343 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
2 Comments
 
LVL 39

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
custom pgsql help 11 204
Convert row to column in Acsess 5 288
How to find the difference between dates within the same column using Netezza 7 286
replicating postgresql database 4 64
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.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

813 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now