Datatypes and performance

From: "Jay O'Connor" <joconnor(at)cybermesa(dot)com>
To: PostgreSQL List <pgsql-general(at)postgresql(dot)org>
Subject: Datatypes and performance
Date: 2003-07-04 16:10:41
Message-ID: 20030704091041.C1100@altaica
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Couple of questions on datat types and performance

1. varchar vs varchar(2)

I created a database schema and based on the test data I had to work with,
I couldn't really determine the max size of a lot of string fields so I
just left a lot of fields as varchar

A comment from a coworker was that this would cause a performance problem

Based on the docs, they say that there's not performance difference between
using varchar(n) and text.

So will leaving my fields as unlimited varchar be a performance issue? Or
should I try to narrow them down?

My coworker has more experience with Oracle and MS-SQL than postgresql

2.varchar and int
I was using a varchar as one field that's part of an index. Looking at the
data, I realized I could just use an int instead. My assumption would be
that an int would be faster to serach for thena varchar, so I converted
the field to int. Is this a valid assumption?

Thanks

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Brian Tarbox 2003-07-04 16:10:46 Re: PostgreSQL vs. MySQL
Previous Message Mattias Kregert 2003-07-04 16:08:25 Re: Q: Executing functions at connect/disconnect?