Correction: datatypes are not "faster" - Mailing list pgsql-docs

From Josh Berkus
Subject Correction: datatypes are not "faster"
Date
Msg-id 4C80208B.4060908@agliodbs.com
Whole thread Raw
Responses Re: Correction: datatypes are not "faster"  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-docs
All,

This is currently in:
http://www.postgresql.org/docs/current/interactive/datatype-numeric.html#DATATYPE-INT


"The type integer is the common choice, as it offers the best balance
between range, storage size, and performance. The smallint type is
generally only used if disk space is at a premium. The bigint type
should only be used if the integer range is insufficient, because the
latter is definitely faster."

This paragraph leaves a *lot* to be desired from an accuracy perspective
and encourages useless byte-counting by amateur performance geeks.  Instead:

The integer type is the most common choice, as it covers a sufficient
range for most operations requiring a non-decimal numeric value.  If,
however, you think you will want to store numbers greater than 2.4
billion, then use bigint.  Note that bigint will require more storage
space and memory.  When you have several integer columns in the same
table with values less than 32,000, you can sometimes achieve
significant space savings by using smallint instead of integer.
Otherwise, using smallint usually results in no real space or memory
savings.


--
                                  -- Josh Berkus
                                     PostgreSQL Experts Inc.
                                     http://www.pgexperts.com

pgsql-docs by date:

Previous
From: Thom Brown
Date:
Subject: Re: Inconsistent index links
Next
From: Tom Lane
Date:
Subject: Re: Correction: datatypes are not "faster"