X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8BDDA9DC813 for ; Thu, 16 Feb 2006 06:55:52 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 55463-06 for ; Thu, 16 Feb 2006 06:55:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from server.gpdnet.co.uk (gpdnet.plus.com [212.56.100.243]) by postgresql.org (Postfix) with ESMTP id B66319DC819 for ; Thu, 16 Feb 2006 06:55:47 -0400 (AST) Received: from www.gpdnet.co.uk (server.gpdnet.co.uk [127.0.0.1]) by server.gpdnet.co.uk (Postfix) with ESMTP id BF4233AAB6B; Thu, 16 Feb 2006 11:06:32 +0000 (GMT) Received: from 84.92.210.49 (SquirrelMail authenticated user gpd) by www.gpdnet.co.uk with HTTP; Thu, 16 Feb 2006 11:06:32 -0000 (GMT) Message-ID: <2417.84.92.210.49.1140087992.squirrel@www.gpdnet.co.uk> In-Reply-To: <21455.1140051584@sss.pgh.pa.us> References: <43F38867.6010701@gpdnet.co.uk> <19510.1140036968@sss.pgh.pa.us> <19779.1140038874@sss.pgh.pa.us> <43F39E53.1020009@gpdnet.co.uk> <20781.1140046109@sss.pgh.pa.us> <43F3BF72.6000202@gpdnet.co.uk> <21152.1140049020@sss.pgh.pa.us> <21455.1140051584@sss.pgh.pa.us> Date: Thu, 16 Feb 2006 11:06:32 -0000 (GMT) Subject: Re: [HACKERS] qsort again (was Re: Strange Create Index From: "Gary Doades" To: "Tom Lane" Cc: pgsql-performance@postgresql.org Reply-To: gpd@gpdnet.co.uk User-Agent: SquirrelMail/1.4.6 [CVS]-0.cvs20050812.1.fc4 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-15 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.111 required=5 tests=[AWL=0.111] X-Spam-Score: 0.111 X-Spam-Level: X-Archive-Number: 200602/239 X-Sequence-Number: 17225 Tom Lane wrote: > I increased the size of the test case by 10x (basically s/100000/1000000/) > which is enough to push it into the external-sort regime. I get > amazingly stable runtimes now --- I didn't have the patience to run 100 > trials, but in 30 trials I have slowest 11538 msec and fastest 11144 msec. > So this code path is definitely not very sensitive to this data > distribution. > > While these numbers aren't glittering in comparison to the best-case > qsort times (~450 msec to sort 10% as much data), they are sure a lot > better than the worst-case times. So maybe a workaround for you is > to decrease maintenance_work_mem, counterintuitive though that be. > (Now, if you *weren't* using maintenance_work_mem of 100MB or more > for your problem restore, then I'm not sure I know what's going on...) > Good call. I basically reversed your test by keeping the number of rows the same (200000), but reducing maintenance_work_mem. Reducing to 8192 made no real difference. Reducing to 4096 flattened out all the times nicely. Slower overall, but at least predictable. Hopefully only a temporary solution until qsort is fixed. My restore now takes 22 minutes :) I think the reason I wasn't seeing performance issues with normal sort operations is because they use work_mem not maintenance_work_mem which was only set to 2048 anyway. Does that sound right? Regards, Gary.