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 215843A1EC4 for ; Mon, 22 Nov 2004 23:04:32 +0000 (GMT) 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 12667-10 for ; Mon, 22 Nov 2004 23:04:20 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 2A3DB3A1D98 for ; Mon, 22 Nov 2004 23:04:20 +0000 (GMT) Received: (qmail 18500 invoked from network); 23 Nov 2004 00:04:46 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 23 Nov 2004 00:04:46 +0100 To: pgsql-performance@postgresql.org Subject: Re: Data type to use for primary key References: <1dc7f0e30411221232603c4617@mail.gmail.com> Message-ID: Date: Tue, 23 Nov 2004 00:06:13 +0100 From: =?iso-8859-15?Q?Pierre-Fr=E9d=E9ric_Caillaud?= Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In-Reply-To: <1dc7f0e30411221232603c4617@mail.gmail.com> User-Agent: Opera M2/7.54 (Linux, build 751) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/340 X-Sequence-Number: 9294 > What is the common approach? Should I use directly the product_code as > my ID, or use a sequantial number for speed? (I did the same for the > company_id, this is a 'serial' and not the shor name of the customer. > I just don't know what is usually done. Use a serial : - you can change product_code for a product easily - you can pass around integers easier around, in web forms for instance, you don't have to ask 'should I escape this string ?' - it's faster - it uses less space - if one day you must manage products from another source whose product_code overlap yours, you won't have problems - you can generate them with a serial uniquely and easily