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.92) (envelope-from ) id 1jClKJ-0004bN-AC for pgsql-general@arkaria.postgresql.org; Fri, 13 Mar 2020 14:30:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jClKD-0007at-Gh for pgsql-general@arkaria.postgresql.org; Fri, 13 Mar 2020 14:30:09 +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 1jClKC-0007am-8F for pgsql-general@lists.postgresql.org; Fri, 13 Mar 2020 14:30:09 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jClK5-0001Sd-Mq for pgsql-general@lists.postgresql.org; Fri, 13 Mar 2020 14:30:04 +0000 Received: by mail-wm1-x341.google.com with SMTP id 25so10197888wmk.3 for ; Fri, 13 Mar 2020 07:30:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=framestore.com; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=1T1qusDhxT+mqyZ/8gFP6eJA1fTH15rTec/zq+q3Np0=; b=X9WfmIf6gFCmkFX+j3TXbIPsISVFKdxCDd0uFgg9K3+D0uFxoNi3KaaAgjIMe/v/Ue PN26g3Z7Xs5JFmiQtDCo5XtTT8Ky8uGdAcIla+DB1D6GgAusgJecWypTxhXxXpa+ZbFY bXTP5uPDmaVl7pvMzzcLrRuS+w6/FvD289E7g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=1T1qusDhxT+mqyZ/8gFP6eJA1fTH15rTec/zq+q3Np0=; b=flFoPku6Tc6xp8mYLTHUJKvXMwFvgf2qQPLZwi84oelMGFd4Jjw1ltCPq616DNHTwc 4ObcoXMMSOcBjyatP0fB+rvREdFb7d09miVurFBLP+dBo9VzLAXHcBY0O8fbpfL1O5Ib Lo9OvQ5ShGysb1lMaFW5vJ7cqgNg8mPRYjy3TLIA1MNAfb9eMXAIWwFYtxaXAAbyeKIQ beVAu2eJr6Bm+peVkU/ZpPIBTAzU21Yc1nYBAxj/xDnYK/nsdelqwWraoe2PmqqzFsuc KmFUqOqkjBTcX63w4S3YNkujyEGuwblvLyQpZL9zGUDFxR7iUXboAFfaXinA8YA0v6SE lKbg== X-Gm-Message-State: ANhLgQ1RXWyUvpi30kSkFSzq0m8HaHRctne+FHjiMipJeJRJ4rIZ1tbD Hq6EM15yhBpODdR8iVbP8Z0yK8HnclE= X-Google-Smtp-Source: ADFU+vtkekj/mb+PU+fxCB0b4RJLCYTcw3EaMmj4EbyTssgEKCjxFnmg/LXAGsPZo03rKxn15bTgkw== X-Received: by 2002:a05:600c:218f:: with SMTP id e15mr11843225wme.152.1584109798059; Fri, 13 Mar 2020 07:29:58 -0700 (PDT) Received: from sys1099.ldn.framestore.com (ldndefault.framestore.com. [185.101.14.7]) by smtp.gmail.com with ESMTPSA id o10sm33263195wru.38.2020.03.13.07.29.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Mar 2020 07:29:57 -0700 (PDT) Subject: Re: ERROR: invalid memory alloc request size 1073741824 To: Tom Lane Cc: Tomas Vondra , Jan Wieck , pgsql-general@lists.postgresql.org References: <733ecd96-48ed-8d49-15e1-413eb535c4c6@framestore.com> <28d517a9-bf36-1a79-c2e7-6356dcd31064@2ndquadrant.com> <9b1b1008-45fd-8c1a-c45b-6b5be9b24e53@2ndquadrant.com> <6704.1583941079@sss.pgh.pa.us> From: Stefan Blanke Message-ID: <1b7edcf7-b662-6b6f-87be-8882841d8064@framestore.com> Date: Fri, 13 Mar 2020 14:29:57 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <6704.1583941079@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > Could you adjust your process to log the actual temp table size > each time, ie "select count(*) from temp_table" in between the > two steps, and then note whether the failures are correlated > with unusual temp table sizes? Thanks, I'll add a count there and come back with a number when we next hit the "invalid memory alloc". Stefan On 11/03/2020 15:37, Tom Lane wrote: > Stefan Blanke writes: >> We've upgraded to PostgreSQL 11.5 (postgresql.org rhel 6 rpm) and I have >> had another occurrence of this invalid alloc of 1GB. Apologies for never >> providing a query plan when discussing this two years ago; we decided to >> move to a newer PostgreSQL to see if the issue went away but took a >> while to complete the move. > >> The invalid alloc still only occurs occasionally every few months on a >> query that we run every minute; so unfortunately we still don't have a >> contained reproducible test case. > > Given the lack of stats, I wonder whether the issue could be related > to the plan sometimes being horribly bad, eg due to the temp table > being much larger than expected. (A possible mechanism would be > hash table bloat, perhaps, but that's getting way ahead of the > evidence.) > > Could you adjust your process to log the actual temp table size > each time, ie "select count(*) from temp_table" in between the > two steps, and then note whether the failures are correlated > with unusual temp table sizes? > > regards, tom lane >