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 C29DE3A22F7 for ; Mon, 22 Nov 2004 23:26:20 +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 24796-02 for ; Mon, 22 Nov 2004 23:26:09 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.200]) by svr1.postgresql.org (Postfix) with ESMTP id AF5D23A1D98 for ; Mon, 22 Nov 2004 23:26:08 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 36so228772wri for ; Mon, 22 Nov 2004 15:26:05 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=s7ZgKawebFhryuQESoRLwevFH39LwEEEgpzA91HSBLKmRWap1YBXMBXrLDdXqLAKh8VCbsgpi1vp9Tabxi61qMdUS0KUP8LZBYFD82F/6hmtvnZ4FlUXj0UQY/yfsGQHsBojnt8jGGmBdzhyrCCVLvyWTcqKQK30HERqRuqkMS4= Received: by 10.54.20.74 with SMTP id 74mr920274wrt; Mon, 22 Nov 2004 15:26:01 -0800 (PST) Received: by 10.54.20.23 with HTTP; Mon, 22 Nov 2004 15:26:00 -0800 (PST) Message-ID: <1dc7f0e304112215265f6ba487@mail.gmail.com> Date: Mon, 22 Nov 2004 18:26:00 -0500 From: Alexandre Leclerc Reply-To: Alexandre Leclerc To: pgsql-performance@postgresql.org Subject: Re: Data type to use for primary key In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable References: <1dc7f0e30411221232603c4617@mail.gmail.com> 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/342 X-Sequence-Number: 9296 Mr Caillaud, Merci! Many points you bring were also my toughts. I was asking myself really this was the way to go. I'm happy to see that my view of the problem was good. Encore merci! (Thanks again!) On Tue, 23 Nov 2004 00:06:13 +0100, Pierre-Fr=E9d=E9ric Caillaud wrote: >=20 > > 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. >=20 > Use a serial : > - you can change product_code for a product easily > - you can pass around integers easier around, in web forms for in= stance, > 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 >=20 > ---------------------------(end of broadcast)--------------------------- > TIP 9: the planner will ignore your desire to choose an index scan if you= r > joining column's datatypes do not match >=20 --=20 Alexandre Leclerc