Datatypes and performance - Mailing list pgsql-general

From Jay O'Connor
Subject Datatypes and performance
Date
Msg-id 20030704091041.C1100@altaica
Whole thread Raw
Responses Re: Datatypes and performance  (Shridhar Daithankar <shridhar_daithankar@persistent.co.in>)
Re: Datatypes and performance  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
Re: Datatypes and performance  (Andrew Sullivan <andrew@libertyrms.info>)
List 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

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: any body using Solaris8 with postgresql 7.3.3
Next
From: Shridhar Daithankar
Date:
Subject: Re: Datatypes and performance