pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tory M Blue <tmblue@gmail.com>
To: Craig James <craig_james@emolecules.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: bigint integers up to 19 digits.
Date: Thu, 4 Feb 2010 10:51:37 -0800
Message-ID: <8a547c841002041051i53d47fe4pf3a96e22bec85200@mail.gmail.com> (raw)
In-Reply-To: <4B6B153D.9030200@emolecules.com>
References: <8a547c841002041015o57d533fdg7237c50dea7a9278@mail.gmail.com>
	<4B6B153D.9030200@emolecules.com>

On Thu, Feb 4, 2010 at 10:43 AM, Craig James <craig_james@emolecules.com> wrote:
> Tory M Blue wrote:
>>
>> I have a column that is a bigint that needs to store integers up to 19
>> digits long. For the most part this works but we sometimes have
>> numbers that are greater than 9223372036854775807.
>> ...
>> I was thinking of changing this to a real or double precision field,
>> but read in the docs that the value stored is not always the value
>> inserted...
>
> They're actually less precise than the same size of integer.  Real/double
> datatypes trade more range for less precision in the same number of bytes.
>
>> My number will always be 19 digits long and always an integer.
>> I looked into the numeric data type, but the docs say that it can be slow.
>
> If it's *always* going to be 19 digits, couldn't you make it a text or char
> field?  You didn't say if this is really a number.  Do you do arithmetic
> with it? Sort it numerically?  Or is it just a long identifier that happens
> to only used digits?

it is an identifier and is always a number and is used in grouping and
querying. I thought I would lose performance if it is text vs an
integer/double field.

Tory



view thread (6+ messages)  latest in thread

Message-ID: <8a547c841002041051i53d47fe4pf3a96e22bec85200@mail.gmail.com>
Permalink:  ../8a547c841002041051i53d47fe4pf3a96e22bec85200@mail.gmail.com/
Also on:    postgresql.org/message-id/8a547c841002041051i53d47fe4pf3a96e22bec85200@mail.gmail.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-performance@postgresql.org
  Cc: tmblue@gmail.com, craig_james@emolecules.com
  Subject: Re: bigint integers up to 19 digits.
  In-Reply-To: <8a547c841002041051i53d47fe4pf3a96e22bec85200@mail.gmail.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