Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 523982E0051 for ; Wed, 21 May 2008 03:16:49 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 44776-05 for ; Wed, 21 May 2008 03:16:40 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from lists.commandprompt.com (host-159.commandprompt.net [207.173.203.159]) by developer.postgresql.org (Postfix) with ESMTP id 9FA0B2E0031 for ; Wed, 21 May 2008 03:16:41 -0300 (ADT) Received: from [192.168.1.226] (or-69-34-217-90.sta.embarqhsd.net [69.34.217.90]) (authenticated bits=0) by lists.commandprompt.com (8.13.8/8.13.8) with ESMTP id m4L6HiFj022931 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 20 May 2008 23:17:49 -0700 Message-ID: <4833BE42.5030409@commandprompt.com> Date: Tue, 20 May 2008 23:16:34 -0700 From: "Joshua D. Drake" Organization: Command Prompt, Inc. User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 To: Robins Tharakan CC: pgsql-performance@postgresql.org Subject: Re: Varchar pkey instead of integer References: <36af4bed0805202240v5fbdd6bcv75643a6488cd1daf@mail.gmail.com> In-Reply-To: <36af4bed0805202240v5fbdd6bcv75643a6488cd1daf@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0 (lists.commandprompt.com [207.173.203.159]); Tue, 20 May 2008 23:17:49 -0700 (PDT) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200805/280 X-Sequence-Number: 30248 Robins Tharakan wrote: > Hi, > Now what I wanted to ask was whether its any different to have the > primary-keys in such master tables as text/varchar rather than integer ? > i.e. Can I use a character varying(10) and use the text 'million' / > 'billion' instead of a serial / integer type ? One should ask themselves why before can I. :) If you want to use a varchar() for a primary key that is fine but make it a natural key not an arbitrary number. If you are going to use arbitrary numbers, use a serial or bigserial. Joshua D. Drake