Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 59F4A64FD87 for ; Sun, 23 Nov 2008 19:11:42 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 33680-06 for ; Sun, 23 Nov 2008 19:11:40 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.gransy.com (nathalia.gransy.com [82.208.29.194]) by mail.postgresql.org (Postfix) with ESMTP id B7BF564FD2A for ; Sun, 23 Nov 2008 19:11:39 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by mail.gransy.com (Postfix) with ESMTP id BD7E07AC00C for ; Mon, 24 Nov 2008 00:11:37 +0100 (CET) Received: from mail.gransy.com ([127.0.0.1]) by localhost (nathalia.gransy.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tgaxOColkTbI for ; Mon, 24 Nov 2008 00:11:37 +0100 (CET) Received: from [192.168.1.1] (ip-89-102-139-23.karneval.cz [89.102.139.23]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.gransy.com (Postfix) with ESMTP id 9BCFE7AC006 for ; Mon, 24 Nov 2008 00:11:37 +0100 (CET) Message-ID: <4929E32C.8080400@fuzzy.cz> Date: Mon, 24 Nov 2008 00:11:40 +0100 From: Tomas Vondra User-Agent: Thunderbird 2.0.0.9 (X11/20080213) MIME-Version: 1.0 CC: pgsql-performance@postgresql.org Subject: Re: Hash join on int takes 8..114 seconds References: <49253FE1.3070706@archonet.com> <0205611B528C4C2CBA99AFC64E57D6E8@andrusnotebook> <75A918DFCF25470FAF96B3FE3D25A38B@andrusnotebook> <4929A533.5030203@fuzzy.cz> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.581 tagged_above=0 required=5 tests=MISSING_HEADERS=1.581 X-Spam-Level: * X-Archive-Number: 200811/223 X-Sequence-Number: 31954 > My test computer has PostgreSql 8.3, 4 GB RAM, SSD disks, Intel X2Extreme > CPU > So it is much faster than this prod server. > No idea how to emulate this environment. > I can create new db in prod server as old copy but this can be used in late > night only. Well, a faster but comparable system may not be a problem - the query might run 10 times faster, but it still will be slow (say 40 seconds instead of 8 minutes). What is a problem is a different I/O system - SSD instead of traditional drives in this case. I have no direct experience with with SSD yet, but AFAIK the seek time is much better compared to regular drives (say 0.1ms instead of 10ms, that is 100-times faster). So you can't just put on old SATA drive into the test machine? > Where to find script which clones some database in server? Something like > > CREATE DATABASE newdb AS SELECT * FROM olddb; > > It would be more convenient to run db cloning script from pgadmin command > window. > Only way I found is to use SSH with pg_dup/pg_restore. This requires SSH > access to server and SSH port opening to public internet. Yes, using pg_dump | pg_restore is probably the way to clone database. But it will slow down the system, as it has to do a lot of I/O (and as it seems to be a bottleneck already, I don't think this is a good idea). > Or probably try to run CLUSTER command in prod server. Hopefully clustering > by product id cannot make things slow > too much. As already noted, CLUSTER command causes exclusive lock on the database. So this is an operation you'd like to do on production server ... Tomas