Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gFEaL-0006UV-UU for pgsql-bugs@arkaria.postgresql.org; Wed, 24 Oct 2018 08:32:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gFEaJ-0006cq-LR for pgsql-bugs@arkaria.postgresql.org; Wed, 24 Oct 2018 08:32:11 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gFEaI-0006ca-2f for pgsql-bugs@lists.postgresql.org; Wed, 24 Oct 2018 08:32:11 +0000 Received: from [66.111.4.221] (helo=new1-smtp.messagingengine.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gFEa8-00089B-LJ for pgsql-bugs@lists.postgresql.org; Wed, 24 Oct 2018 08:32:08 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id 9A80F2F0F; Wed, 24 Oct 2018 04:31:39 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Wed, 24 Oct 2018 04:31:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=yLXADTDb/xKFMbtdzl7APHNdBFi 7AsMW56IfaHU6NWQ=; b=DBuA4ApUN6MZA5PpRsg2CNtWGBOsJWkcvUEhrD7Mn8I AGDQAUsY/Ouav+CkITNxUprTgniH4Ylngt1R1IjXAOhphsjGNBB2KbNj54L6h2x5 rmKG7F8Qgza9WgVmZOivB/P8lj4KEoon+ZwgVRgBsekYJo0fFLRIkJ152EfoYw2E rgdGX8yL3yjStTanBwO9yR9JOtVnPJPZRYWlQfGoE4I49N4H5+gCgToZ0w7aJrBJ A9/lxukuStnwlaQVhCiZnRxVh2RbxRLYYdpkNTsgHGE9ZvPswc9ZRLQla+nuhwD9 +9D0/qJ3z0eZtw7rtKssEJAIrqNXiRxXB6admNYiWbg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=fm1; bh=yLXADT Db/xKFMbtdzl7APHNdBFi7AsMW56IfaHU6NWQ=; b=L/MF8GwvquX3aqtrAjq+RB 3xLaIE30E2PE9RLWppoRBwpST+MKxyyqnw6+lJVHry6b0MdKv34jovUrZFOrqC4V o5nVVdj/EqDAlZ1lkj9I2FDkFZml6NVgWhyTiqE5+VK543IaKUAjFiRey3QbcDAU RdDnOAURYSweUBSe+flkmPMlA9Z82OMr4j2j10UbNRcLvFVtFfGZjTdvvcGcNMkw m0zsOCnNdPyYvvqoMlX49K4ucYIR87CSxAYCgrE1cv7xa3dsL/g06E6NONojVjdu ehw5D4yLbWZ9s/L1dgUA9SaaDGU0wMPmuvgrkQeNV20QxSXP6LKC1DHxXMYvVYXw == X-ME-Sender: X-ME-Proxy: Received: from intern.anarazel.de (unknown [88.157.232.34]) by mail.messagingengine.com (Postfix) with ESMTPA id 9B37CE43AC; Wed, 24 Oct 2018 04:31:38 -0400 (EDT) Date: Wed, 24 Oct 2018 01:31:36 -0700 From: Andres Freund To: Dilip Kumar Cc: andrea.ferranti@wolterskluwer.com, PostgreSQL mailing lists Subject: Re: BUG #15455: Endless lseek Message-ID: <20181024083136.ug2cap6wycufienv@alap3.anarazel.de> References: <15455-7429982393b511ab@postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Host-Lookup-Failed: Reverse DNS lookup failed for 66.111.4.221 (deferred) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2018-10-24 11:14:29 +0530, Dilip Kumar wrote: > On Tue, Oct 23, 2018 at 9:35 PM PG Bug reporting form > wrote: > > > > The following bug has been logged on the website: > > > > Bug reference: 15455 > > Logged by: Andrea Ferranti > > Email address: andrea.ferranti@wolterskluwer.com > > PostgreSQL version: 9.6.10 > > Operating system: Ubuntu 16 > > Description: > > > I think you have already raised the same bug "BUG #15454: Endless > lseek", Seems this is duplicate. I think the other bug is incomplete / truncated... > > We have experienced a strange behaviour on PostgreSQL 9.6.10. > > (for privacy reason I cannot copy the exact query and data on which query > > are performed). > > > > We have a series of query that move data from a table to another by using > > the following logic. > > > > create table A; > > insert data into A from B; > > ; > > drop B; > > rename A to B; > > > > the step has the following logic: > > > > INSERT INTO A SELECT X > > FROM B DEST_TABLE JOIN ( > > SELECT --- > > FROM B SOURCE_TABLE) > > SOURCE_TABLE > > ON SOURCE_TABLE.S0 = DEST_TABLE. > > AND SOURCE_TABLE.S1 = DEST_TABLE. > > > > the last query doesn't terminate. > > In particular, we have found that the inner select (...FROM A JOIN B...) > > generate a series of lseek as following. > > > > (we have execute a strace of posgtreSQL process) > > by adding a "sleep" of 30 seconds before the > from B>; everything works and following is the strace of the correct > > process: I assume this might "just" be a chance for autovacuum to analyze the table. If you do an EXPLAIN of the query both with the 30s wait and without, does the plan change? Does adding an explicit ANALYZE of both a and b before inserting fix the issue? Greetings, Andres Freund