pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: pgsql-docs@postgreSQL.org
Subject: Correction: datatypes are not "faster"
Date: Thu, 02 Sep 2010 15:09:15 -0700
Message-ID: <4C80208B.4060908@agliodbs.com> (raw)

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



view thread (5+ messages)  latest in thread

Message-ID: <4C80208B.4060908@agliodbs.com>
Permalink:  ../4C80208B.4060908@agliodbs.com/
Also on:    postgresql.org/message-id/4C80208B.4060908@agliodbs.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: josh@agliodbs.com
  Subject: Re: Correction: datatypes are not "faster"
  In-Reply-To: <4C80208B.4060908@agliodbs.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox