X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EAC59DA093 for ; Tue, 4 Oct 2005 18:37: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 91630-01 for ; Tue, 4 Oct 2005 21:37:17 +0000 (GMT) Received: from cluster1.echolabs.net (mail.atlanticbb.net [216.52.118.222]) by svr1.postgresql.org (Postfix) with ESMTP id B6D45DA054 for ; Tue, 4 Oct 2005 18:37:18 -0300 (ADT) X-Scanned-By: RAE MPP/Clamd http://www.messagepartners.com X-Scanned-By: RAE MPP/Cloudmark http://www.messagepartners.com Received: from [216.189.176.72] (account jma@atlanticbb.net HELO [127.0.0.1]) by fe2.cluster1.echolabs.net (CommuniGate Pro SMTP 4.3.7) with ESMTPA id 83727318; Tue, 04 Oct 2005 17:37:20 -0400 Message-ID: <4342F61A.1010903@freedomcircle.net> Date: Tue, 04 Oct 2005 17:37:30 -0400 From: Joe Organization: Freedom Circle, LLC User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Jim C. Nasby" Cc: Gavin Sherry , Magnus Hagander , pgsql-performance@postgresql.org Subject: Re: Comparative performance References: <6BCB9D8A16AC4241919521715F4D8BCE92E6D6@algol.sollentuna.se> <433BDB0B.8010002@freedomcircle.net> <433BE1A0.5000807@freedomcircle.net> <20051004203102.GU40138@pervasive.com> In-Reply-To: <20051004203102.GU40138@pervasive.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.068 required=5 tests=[AWL=0.018, FORGED_RCVD_HELO=0.05] X-Spam-Level: X-Archive-Number: 200510/55 X-Sequence-Number: 14823 Jim C. Nasby wrote: > Make sure these indexes exist if you'll be updating or inserting into > entry: > > CREATE INDEX topic__subject_id ON topic(subject_id); > CREATE INDEX topic__actor_id ON topic(actor_id); Actually, topic's primary key is topic_id. > Also, the fact that subject and actor both point to topic along with > subject_type and actor_type make me suspect that your design is > de-normalized. Of course there's no way to know without more info. Yes, the design is denormalized. The reason is that a book or article is usually by a single author (an "actor" topic) and it will be listed under one main topic (a "subject" topic). There's a topic_entry table where additional actors and subjects can be added. It's somewhat ironic because I used to teach and/or preach normalization and the "goodness" of a 3NF+ design (also about having the database do aggregation and sorting as you mentioned in your other email). > FWIW, I usually use timestamptz for both created and updated fields. IIRC 'created' ended up as a DATE because MySQL 4 has a restriction about a single TIMESTAMP column per table taking the default value of current_timestamp. Joe