Solved

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

Posted on 2011-03-03
2
1,320 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
Comment Utility
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
Comment Utility
thanks
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

762 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

6 Experts available now in Live!

Get 1:1 Help Now