Re: int2 vs int4 in Postgres

From: Chris Browne <cbbrowne(at)acm(dot)org>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: int2 vs int4 in Postgres
Date: 2005-09-26 21:45:56
Message-ID: 60br2flcyz.fsf@dba2.int.libertyrms.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

truthhurts(at)insightbb(dot)com ("Announce") writes:
> I KNOW that I am not going to have anywhere near 32,000+ different
> genres in my genre table so why use int4? Would that squeeze a few
> more milliseconds of performance out of a LARGE song table query
> with a genre lookup?

If the field is immaterial in terms of the size of the table, then it
won't help materially.

If you were going to index on it, however, THAT would make it
significant for indices involving the "genre" column. Fitting more
tuples into each page is a big help, and this would help.

I doubt it'll be material, but I'd think it a good thing to apply what
restrictions to your data types that you can, a priori, so I'd be
inclined to use "int2" for this...
--
let name="cbbrowne" and tld="cbbrowne.com" in String.concat "@" [name;tld];;
http://cbbrowne.com/info/nonrdbms.html
Rules of the Evil Overlord #136. "If I build a bomb, I will simply
remember which wire to cut if it has to be deactivated and make every
wire red." <http://www.eviloverlord.com/>

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Chris Browne 2005-09-26 21:47:19 Re: int2 vs int4 in Postgres
Previous Message Neil Conway 2005-09-26 19:48:30 Re: int2 vs int4 in Postgres