Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YXacf-0004Xa-CC for pgsql-performance@arkaria.postgresql.org; Mon, 16 Mar 2015 19:24:21 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YXace-0001u6-J1 for pgsql-performance@arkaria.postgresql.org; Mon, 16 Mar 2015 19:24:20 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YXacZ-0001ko-Qp for pgsql-performance@postgresql.org; Mon, 16 Mar 2015 19:24:15 +0000 Received: from mail-bn1bon0613.outbound.protection.outlook.com ([2a01:111:f400:fc10::1:613] helo=na01-bn1-obe.outbound.protection.outlook.com) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YXacV-00041M-DP for pgsql-performance@postgresql.org; Mon, 16 Mar 2015 19:24:13 +0000 Received: from decina.attlocal.net (2602:306:ce8b:3460:bc26:f347:3a6e:b9f2) by BY1PR11MB0341.namprd11.prod.outlook.com (25.160.206.154) with Microsoft SMTP Server (TLS) id 15.1.112.19; Mon, 16 Mar 2015 19:24:00 +0000 Message-ID: <55072DE6.1070005@BlueTreble.com> Date: Mon, 16 Mar 2015 14:24:22 -0500 From: Jim Nasby User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Gunnlaugur Thor Briem , Tomas Vondra CC: Jeff Janes , Tom Lane , Kevin Grittner , "pgsql-performance@postgresql.org" Subject: Re: EXPLAIN (no ANALYZE) taking an hour for INSERT FROM SELECT References: <54F9E179.4000804@2ndquadrant.com> <1407502480.21180.1425691482543.JavaMail.yahoo@mail.yahoo.com> <27245.1425692294@sss.pgh.pa.us> <54FB1CDA.1080606@2ndquadrant.com> In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [2602:306:ce8b:3460:bc26:f347:3a6e:b9f2] X-ClientProxiedBy: BN1PR12CA0006.namprd12.prod.outlook.com (25.160.77.16) To BY1PR11MB0341.namprd11.prod.outlook.com (25.160.206.154) Authentication-Results: postgresql.org; dkim=none (message not signed) header.d=none; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR11MB0341; X-Microsoft-Antispam-PRVS: X-Forefront-Antispam-Report: BMV:1; SFV:NSPM; SFS:(10009020)(6009001)(377454003)(24454002)(479174004)(2950100001)(92566002)(62966003)(53416004)(42186005)(77156002)(65806001)(65956001)(40100003)(15975445007)(93886004)(47776003)(80316001)(83506001)(36756003)(122386002)(46102003)(87266999)(50986999)(50466002)(19580395003)(86362001)(33656002)(99136001)(54356999)(23676002)(87976001)(3826002)(85282002)(217873001)(18886065003); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR11MB0341; H:decina.attlocal.net; FPR:; SPF:None; MLV:sfv; LANG:en; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(5002010); SRVR:BY1PR11MB0341; BCL:0; PCL:0; RULEID:; SRVR:BY1PR11MB0341; X-Forefront-PRVS: 05177D47DC X-OriginatorOrg: bluetreble.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Mar 2015 19:24:00.0702 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR11MB0341 X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org On 3/11/15 10:54 AM, Gunnlaugur Thor Briem wrote: > (Even better, just make the new table not temporary, and have it replace > the former table altogether. But that's for later; requires some broader > changes in our application.) The other thing you should consider is using TRUNCATE instead of an un-filtered DELETE. It will both be much faster to perform and won't leave any dead rows behind. -- Jim Nasby, Data Architect, Blue Treble Consulting Data in Trouble? Get it in Treble! http://BlueTreble.com -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance