Correction: datatypes are not "faster"

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: pgsql-docs(at)postgreSQL(dot)org
Subject: Correction: datatypes are not "faster"
Date: 2010-09-02 22:09:15
Message-ID: 4C80208B.4060908@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2010-09-02 22:13:39 Re: Correction: datatypes are not "faster"
Previous Message Tom Lane 2010-09-02 19:12:10 Re: issue about information_schema REFERENTIAL_CONSTRAINTS