X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 31DEE9FB35D for ; Mon, 31 Jul 2006 05:56:02 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 65188-01 for ; Mon, 31 Jul 2006 05:55:46 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp7.libero.it (smtp7.libero.it [193.70.192.90]) by postgresql.org (Postfix) with ESMTP id 133199FB1DD for ; Mon, 31 Jul 2006 05:55:30 -0300 (ADT) Received: from localhost (172.16.1.203) by smtp7.libero.it (7.0.027-DD01) id 449964D7034A9064; Mon, 31 Jul 2006 10:55:16 +0200 Received: from smtp3.libero.it ([172.16.1.53]) by localhost (asav17.libero.it [193.70.193.4]) (amavisd-new, port 10024) with ESMTP id 26390-04; Mon, 31 Jul 2006 10:55:15 +0200 (CEST) Received: from [151.55.240.224] (unknown [151.55.240.224]) by smtp3.libero.it (Postfix) with ESMTP id 40CCBABE28; Mon, 31 Jul 2006 10:55:15 +0200 (MEST) Message-ID: <44CDC607.6080006@libero.it> Date: Mon, 31 Jul 2006 10:57:43 +0200 From: Manlio Perillo User-Agent: Mozilla Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: Aaron Bono CC: Michael Glaesemann , pgsql-sql@postgresql.org Subject: Re: primary keys as TEXT References: <44C9CCC8.8020304@libero.it> <6ACD839C-D68A-4BD1-804F-B9DEACFC2ED1@seespotcode.net> <44CA6E29.4000201@libero.it> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Scanned: with antispam and antivirus automated system at libero.it X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.908 tagged_above=0 required=5 tests=AWL, SPF_HELO_SOFTFAIL, SPF_SOFTFAIL X-Spam-Level: * X-Archive-Number: 200607/374 X-Sequence-Number: 25948 Aaron Bono ha scritto: > On 7/28/06, *Manlio Perillo* > wrote: > > Michael Glaesemann ha scritto: > > > > On Jul 28, 2006, at 17:37 , Manlio Perillo wrote: > > > >> There can be performancs problems in having primary keys of type > TEXT? > >> What about having a primary key of 3 columns (all of type TEXT)? > > > > What defines a problem in terms of performance is heavily dependent on > > your particular needs and requirements. What are your > requirements? What > > profiling have you done to see where your performance bottlenecks > may be? > > > > I still don't have done profiling. > > Simply in the first version of my schema I used serial keys but the > result is ugly and it force me to do a lot of joins. > > > > Ugly? Not sure what you mean by that. > Because serial ids are only surrogate keys. My tables have well definited primary keys, the only problem is that they are of type TEXT (and spawn up to 3 columns). My concern is: how bad can be performance? > I do understand the problem with so many joins. I use views so that the > joins are only delt with once (in the database) and then all my > applications run off the views. That way, the applications use very > simple queries. The views also allow me to change the table structure > (column names, more table normalization, etc.) without having to make > changes to the application. > View are a good idea, thanks. Regards Manlio Perillo