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 CBF4BD88FF for ; Thu, 1 Sep 2005 17:54:40 -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 18524-10 for ; Thu, 1 Sep 2005 20:54:39 +0000 (GMT) Received: from olive.qinip.net (olive.qinip.net [62.100.30.40]) by svr1.postgresql.org (Postfix) with ESMTP id D53A6D88A6 for ; Thu, 1 Sep 2005 17:54:38 -0300 (ADT) Received: from [10.0.0.2] (h8441139206.dsl.speedlinq.nl [84.41.139.206]) by olive.qinip.net (Postfix) with ESMTP id 4AB47180CD; Thu, 1 Sep 2005 22:54:36 +0200 (MEST) Message-ID: <43176A95.70506@tweakers.net> Date: Thu, 01 Sep 2005 22:54:45 +0200 From: Arjen van der Meijden User-Agent: Mozilla Thunderbird 1.0RC1 (Windows/20041201) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Matthew Sackman Cc: pgsql-performance@postgresql.org Subject: Re: Massive performance issues References: <20050901174231.GE23970@pongo.lshift.net> In-Reply-To: <20050901174231.GE23970@pongo.lshift.net> 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 required=5 tests=[none] X-Spam-Level: X-Archive-Number: 200509/24 X-Sequence-Number: 14332 On 1-9-2005 19:42, Matthew Sackman wrote: > Obviously, to me, this is a problem, I need these queries to be under a > second to complete. Is this unreasonable? What can I do to make this "go > faster"? I've considered normalising the table but I can't work out > whether the slowness is in dereferencing the pointers from the index > into the table or in scanning the index in the first place. And > normalising the table is going to cause much pain when inserting values > and I'm not entirely sure if I see why normalising it should cause a > massive performance improvement. In this case, I think normalising will give a major decrease in on-disk table-size of this large table and the indexes you have. If that's the case, that in itself will speed-up all i/o-bound queries quite a bit. locality_1, _2, city and county can probably be normalised away without much problem, but going from varchar's to integers will probably safe you quite a bit of (disk)space. But since it won't change the selectivity of indexes, so you won't get more index-scans instead of sequential scans, I suppose. I think its not that hard to create a normalized set of tables from this data-set (using insert into tablename select distinct ... from address and such, insert into address_new (..., city) select ... (select cityid from cities where city = address.city) from address) So its at least relatively easy to figure out the performance improvement from normalizing the dataset a bit. If you want to improve your hardware, have a look at the Western Digital Raptor-series SATA disks, they are fast scsi-like SATA drives. You may also have a look at the amount of memory available, to allow caching this (entire) table. Best regards, Arjen