Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iCZ9u-0008MT-VA for pgsql-general@arkaria.postgresql.org; Tue, 24 Sep 2019 00:58:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iCZ9t-0000Lh-QY for pgsql-general@arkaria.postgresql.org; Tue, 24 Sep 2019 00:58:25 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iCZ9t-0000La-Ed for pgsql-general@lists.postgresql.org; Tue, 24 Sep 2019 00:58:25 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iCZ9r-0008EL-4T for pgsql-general@lists.postgresql.org; Tue, 24 Sep 2019 00:58:24 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 86F1F57E; Mon, 23 Sep 2019 20:58:21 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Mon, 23 Sep 2019 20:58:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=S jLN7MSt/zyQlrM83N3fM4p6LIJIDoTo0hQWPEl15+0=; b=XnN1M7wE/hWuCdqZ7 HIXhbkxji1avKddUB6SaSCZ4VDGWTbyt5f9OlykXFVrceNnKz8k9jQV0wYmJr0Lm cbXE+N7JMTptl4Lk8tzTCLW69TduPMPbaPeKFcWlRYx47KuttzSQOPjn3T1bjcYn 9j+g7er0uq43eLEg9hWxAPlAVOTMyV2sMepePLZj+7K6uVTINMzkkgHQKqee0TAM /48bPthIkLBBXKKPxVnh1KBT2M3P2CMd44CAexFP/2Sk2U3a4lZmZ5RhCKVjQJ9z HYazFv3ixmxZ6I+Ucjy+zywIfsfe7w6E4scTpetRw5UzzejjXagtH9HJBFsofKZ7 dMIFQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=SjLN7MSt/zyQlrM83N3fM4p6LIJIDoTo0hQWPEl15 +0=; b=TFqgjLZGQMGAJJWmE0skHytxreHFl5uWC9pDFsnvhyO4Q2XtPzoRP22i+ iTfQ9L2TAq6H1+1usMHHqOlAjAwty+JWC+S+phqIFqZK17D3gkYHxMmhGeBKv15+ OiY7KSQRTNBL/3h3Da2LXlsMSyEWrkWNSLtymVAAmLviM+e2U/tr92lfvlKTDb85 GUxpa4hQJT8NmtsHp+nJxvIcNFyuDdtPmD2F9qqI1H6+qXsn/N/p0a02ZV08gP93 i71+QT9t3HeVTScVp+xWQRb/ItH8njaJtZKix0fco6t+XsdEtasycfnHseTkzJ65 PF2/K0xuBcZKEdW9gdbmB7SgiVIDA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrvdelgdegtdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepuffvfhfhkffffgggjggtgfesthekre dttdefjeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhl rghvvghrsegrkhhlrghvvghrrdgtohhmqeenucfkphepudejgedrvddurdejkedrudeike enucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgr vhgvrhdrtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from [192.168.1.3] (174-21-78-168.tukw.qwest.net [174.21.78.168]) by mail.messagingengine.com (Postfix) with ESMTPA id 3CAB58005B; Mon, 23 Sep 2019 20:58:20 -0400 (EDT) Subject: Re: postgres 9.6: insert into select finishes only in pgadmin not psql To: Corey Taylor Cc: Tom Lane , pgsql-general@lists.postgresql.org References: <11667.1568842347@sss.pgh.pa.us> <26981.1569247037@sss.pgh.pa.us> <0745ddd3-0934-53d3-8b8d-41f2724f8247@aklaver.com> <0d6e6bd8-20db-5902-f5eb-7130ff5543d0@aklaver.com> From: Adrian Klaver Message-ID: <7830f74b-f4cf-ece2-c088-52c2f621e6aa@aklaver.com> Date: Mon, 23 Sep 2019 17:58:19 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 9/23/19 5:28 PM, Corey Taylor wrote: > On Mon, Sep 23, 2019 at 7:23 PM Adrian Klaver > wrote: > > "Once restored, it is wise to run ANALYZE on each restored table so the > optimizer has useful statistics; see Section 24.1.3 and Section 24.1.6 > for more information." > > So is there some other step in the process that occurs after the > restore > and before you run your function? > > > There are several other restore called and a delete query that clears > out an unrelated table. > > However, I think this solves the issue for us and the mystery. The > ANALYZE was missing which reduces an unending query down to a minute. > The ANALZYE runs very quickly on its own so we're simply going to fix > the issue by following documented advice. Aah, so it was the common case. Order is restored to the Postgres Universe:) > > I guess the length of the query when before/during the ANALZYE felt like > something more was wrong. > > corey -- Adrian Klaver adrian.klaver@aklaver.com