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 1iWigq-0000EJ-EG for pgsql-performance@arkaria.postgresql.org; Mon, 18 Nov 2019 15:11:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iWifo-0003vI-Tl for pgsql-performance@arkaria.postgresql.org; Mon, 18 Nov 2019 15:10:40 +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 1iWifo-0003vB-Gc for pgsql-performance@lists.postgresql.org; Mon, 18 Nov 2019 15:10:40 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iWifl-0002WF-KN for pgsql-performance@lists.postgresql.org; Mon, 18 Nov 2019 15:10:38 +0000 Received: by mail-wm1-x334.google.com with SMTP id b11so17780094wmb.5 for ; Mon, 18 Nov 2019 07:10:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=/UeiiV26lG3neAAB2wisfeyEPcyKKYKCfdA4LyyJ7CI=; b=UEukyhoKA0zcW3URdyj+zuI+ECl5sk4hhq8O/wZ1Csiv9HxDgnYkcBeD+jMmZldzin T1WDQ6kdEgT7DgSTXOFaUPJuNYOBzmz0hv1mlo5XDarlsGuNAY0tS1YqYkCjbYvkL93p iu2FiBb4ZPO+J8JWBJWTwxduCTX1beUIi7AgPj3omufXjPryhOtKXIBp4OUTSj5hjW9R m5PejjoUh76L9WfTcmA5wf7zsEuDdobHlemPyvhNYripsheSIADyPmGqLjrN7KeVMDWy 7IcZuk+VcbXx3XnNLdcd37o/lEqp8yJsf9u5Mh0l3bbpn22NPLYGaRerScSuSOcgXtDh /Xtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=/UeiiV26lG3neAAB2wisfeyEPcyKKYKCfdA4LyyJ7CI=; b=liqVsquEjOkB+xfQjYzDDovqWAS5fC5kwg3njOUsrn5dS8E3gNSri87RjxVs6TIVbc fLNNWn9pVDK9fJcIeOgZ9HA4Lh+zME6F5TUo/l4sAClJ1bvAW/dQMWlPEn33dApZb/Hf 0Ul6CNU/9i0LFJP6d8mkMVZntsrBMM4+7fNb7hr9zV7fUGqNt2zsRx1oC8PKx7cPBiXc qE3cIn3FvzldDv0XdGXY2QZwhrv6WPRk00Ibjlsc04pIm0cLNytbU2owfnzeXueDVSqe kQa01rKfAmi3b0OvUpv4D/0HE7oEqUzlTHdHwc92Wqt0Kev8Sjgp3TebhnKI9zcQGFBh 2P3g== X-Gm-Message-State: APjAAAWS5IGtMhlwiMAr92mCVvho4vcu16WTP106p9589OngXMtx0jem e2gILZtKjAbPV6j1x3T6I2au9g== X-Google-Smtp-Source: APXvYqw+mYuLJLBiftoZhSbIdmRIil5YdgD8nUrNd2sSUJqNUmWWal6Yuq1V5Z31d0yCPikXfMB+oQ== X-Received: by 2002:a7b:c959:: with SMTP id i25mr29476442wml.100.1574089836047; Mon, 18 Nov 2019 07:10:36 -0800 (PST) Received: from localhost (static-84-42-175-93.net.upcbroadband.cz. [84.42.175.93]) by smtp.gmail.com with ESMTPSA id 19sm26542163wrc.47.2019.11.18.07.10.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Nov 2019 07:10:34 -0800 (PST) Date: Mon, 18 Nov 2019 16:10:33 +0100 From: Tomas Vondra To: Ekaterina Amez Cc: pgsql-performance@lists.postgresql.org Subject: Re: Out of memory error on automatic vacuum Message-ID: <20191118151033.jp7hctb3rl5jqynz@development> References: <20191118122528.45k3jpgaxevsyser@development> <20191118141605.4mmynff64c5prxgf@development> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Mon, Nov 18, 2019 at 03:46:03PM +0100, Ekaterina Amez wrote: > >El 18/11/19 a las 15:16, Tomas Vondra escribió: >> >>Not sure I understand. Whenever PostgreSQL process needs memory it >>requests it from the kernel by calling malloc(), and the amount of >>availabe RAM is limited.  So when kernel can't provide more memory, >>it returns NULL. >> >Understood. > >> >>If it finished a couple of minutes before, it's unlikely to be the >>related. But hard to say, without knowing the details. > >Yeah, I thought the same but for me is too much coincidence and is >suspicious (or at least a thing to have in mind). > > >>No, that's just one of the memory contexts (they form a tree), using >>only 1kB of memory. What matters is the "grand total" >> >>Grand total: 1009356 bytes in 130 blocks; 436888 free (72 chunks); >>572468 used >> >>which is ~1MB. >> >OK, in my lack of knowledge I was understanding "memory context" as >the whole message. > > >>Another thing you might do is adding a swap (if you don't have one >>already), as a safety. >> >> >Excuse my ignorance but... swap? You mean some mechanism that prevents >server to be unavailable by having a second instance running but not >accesible and changing from one to the other when the main fails? >(It's the best way I find to describe it, as I don't usually >speak/write english). > swap = space on disk, so that OS can page out unused data from RAM when there's memory pressure It's a basic sysadmin knowledge, I think. Search for mkswap. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services