X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6CDD814B2821 for ; Wed, 11 Aug 2004 16:20:22 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72563-06 for ; Wed, 11 Aug 2004 19:20:13 +0000 (GMT) Received: from smtp110.mail.sc5.yahoo.com (smtp110.mail.sc5.yahoo.com [66.163.170.8]) by svr1.postgresql.org (Postfix) with SMTP id 3734014B2806 for ; Wed, 11 Aug 2004 16:20:12 -0300 (ADT) Received: from unknown (HELO jupiter.black-lion.info) (janwieck@68.80.245.191 with login) by smtp110.mail.sc5.yahoo.com with SMTP; 11 Aug 2004 19:20:13 -0000 Received: from [172.21.8.18] (ismtp.afilias.com [216.217.55.254]) (authenticated bits=0) by jupiter.black-lion.info (8.12.10/8.12.9) with ESMTP id i7BJK2T7001460; Wed, 11 Aug 2004 15:20:02 -0400 (EDT) (envelope-from JanWieck@Yahoo.com) Message-ID: <411A715C.70808@Yahoo.com> Date: Wed, 11 Aug 2004 15:19:56 -0400 From: Jan Wieck User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.1) Gecko/20040707 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Scott Marlowe Cc: galvao@galvao.eti.br, pgsql-performance@postgresql.org Subject: Re: NUMERIC x VARCHAR References: <4119B1C9.2010800@galvao.eti.br> <1092205308.27166.358.camel@localhost.localdomain> In-Reply-To: <1092205308.27166.358.camel@localhost.localdomain> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=2.6 tagged_above=0.0 required=5.0 tests=RCVD_IN_DYNABLOCK, RCVD_IN_SORBS X-Spam-Level: ** X-Archive-Number: 200408/164 X-Sequence-Number: 7800 On 8/11/2004 2:21 AM, Scott Marlowe wrote: > On Tue, 2004-08-10 at 23:42, Er Galvão Abbott wrote: >> Greetings. >> >> I have a question regarding performance of certain datatypes: >> >> I have a field where I will store my clients phone numbers. I know >> that this field will never exceed 15 characters, and I will store only >> numbers here (no dashes, dots, etc...), so I was wondering: >> >> Wich type is faster: NUMERIC(15,0) or VARCHAR(15)? Are there any >> storage differences between them? > > Since numerics are stored as text strings, the storage would be > similar. Numerics, however, may be slower since they have more > constraints built in. If you throw a check constraint on the > varchar(15) then it will likely be about the same speed for updating. They are stored as an array of signed small integers holding digits in base-10000, plus a precision, scale and sign. That's somewhat different from text strings, isn't it? Jan > > text type with a check contraint it what i'd use. That way if you want > to change it at a later date you just drop and recreate your constraint. > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faqs/FAQ.html -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #================================================== JanWieck@Yahoo.com #