Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id CD3E8635FAE for ; Thu, 4 Feb 2010 14:52:00 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 04267-02-5 for ; Thu, 4 Feb 2010 18:51:50 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-px0-f194.google.com (mail-px0-f194.google.com [209.85.216.194]) by mail.postgresql.org (Postfix) with ESMTP id A1E716340AD for ; Thu, 4 Feb 2010 14:51:38 -0400 (AST) Received: by pxi32 with SMTP id 32so1200644pxi.15 for ; Thu, 04 Feb 2010 10:51:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=4wV56Z6M4A38ydy3mZ66ZlyiQjnNg922cRG9UteIleE=; b=sWqik10+aNwvGd52tVe/v+/REw6gXx/N37/NX8KaF1pM6NIhcloV8TO4DGcMsHb8WP R587AwA46oIalWQ1GAzvbwsFU/fNTVbJbCLbulP+FMcxGcyHyXk38hWBG5acDT1xY0BM oO3AzxrShid+N903//Wt3U9Z2+4fhncSVpj0I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=iiajvbWYN2bUnhwf6zNfXVYuk/zf9VNMynWwnw+YRqs6SpMMMEbm5rxfE69aLV7tge 0NZt9EgM1La+df73ZmLDx2yX/Ylhw4lA00B7yGfdqFB1O6Dwe19HwK6X9VdMMt0jKVcc ShASNPnBND6aOSPqhd68iWrxl89edteb3L3hE= MIME-Version: 1.0 Received: by 10.140.56.17 with SMTP id e17mr1019546rva.98.1265309497315; Thu, 04 Feb 2010 10:51:37 -0800 (PST) In-Reply-To: <4B6B153D.9030200@emolecules.com> References: <8a547c841002041015o57d533fdg7237c50dea7a9278@mail.gmail.com> <4B6B153D.9030200@emolecules.com> Date: Thu, 4 Feb 2010 10:51:37 -0800 Message-ID: <8a547c841002041051i53d47fe4pf3a96e22bec85200@mail.gmail.com> Subject: Re: bigint integers up to 19 digits. From: Tory M Blue To: Craig James Cc: pgsql-performance@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201002/91 X-Sequence-Number: 37512 On Thu, Feb 4, 2010 at 10:43 AM, Craig James w= rote: > 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. =A0Real/doub= le > 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 slo= w. > > If it's *always* going to be 19 digits, couldn't you make it a text or ch= ar > field? =A0You didn't say if this is really a number. =A0Do you do arithme= tic > with it? Sort it numerically? =A0Or is it just a long identifier that hap= pens > 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