Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eJkmS-0008B8-NL for pgsql-general@arkaria.postgresql.org; Tue, 28 Nov 2017 18:38:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eJkmR-0004YX-53 for pgsql-general@arkaria.postgresql.org; Tue, 28 Nov 2017 18:38:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eJkmQ-0004YN-Tz for pgsql-general@lists.postgresql.org; Tue, 28 Nov 2017 18:38:50 +0000 Received: from mail-wm0-x232.google.com ([2a00:1450:400c:c09::232]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eJkmJ-0008SU-17 for pgsql-general@postgresql.org; Tue, 28 Nov 2017 18:38:50 +0000 Received: by mail-wm0-x232.google.com with SMTP id f140so1385436wmd.2 for ; Tue, 28 Nov 2017 10:38:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=AeitCMaDMxG6DEzcIi9iBbuJ8QhkyDfWae5j3dZY0G0=; b=uH0Zk2Tv0MDyoY8Vby5PQHMu7aNsrzFhDc4EDNaKfoxttNANqQBnI7YQain0ysfJAx FcvPLRWE3PPDoyCrJIBkhrWbcg/FM5b9UADpM08zzSq65YNScIEXRDZye5KlSN7m+WaK +qbRVHcGBwjp36gvSTBoYrpUCbBUxlsPez9jiTaWViXKHh2K8mM2xf0cQGYCbW77hYQd o1Nv8UDgx4sgE+eVVsed2t4fZ49HmT/UK7ekxrBZLCExtYA/VbhIcDMzBsr4FfqoRjtn jlRzchhgsYOUCqpd9urDzeMFmH3TGEL9fx88tK8kvqG1VEjKQFIlYZtFCjtE8AK9VtPE 1anA== 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=AeitCMaDMxG6DEzcIi9iBbuJ8QhkyDfWae5j3dZY0G0=; b=mWEvTfr8Akhd/Gku2IT22U89gAh96SpWu4c5feLBf7lZO9drqs+39Gw0P72ggDv6PS SKlY1udVl/ihbBCNpNufQVZlGEIzT+05gR2qQtGyiqRBIvC8vlbvqHLFItj8AfkqOR3H LbT8luCRpsmw+R5nKT5nZnCq3ljWRbGYFRO29qV3zuSnOfMLD9NCKVbjLod6uVH5rqlT TnuRq281XrIM6515LTEy/EDccN+1IndUH07oocxrRQUuRdxmNBUEAmZqmld0ZcMbDYcJ hir14NHmtelB8eNXuc3dy7WyIPSF+7lcv7i6gMyMo9v6uswbPWX9XcnnWuMBJj+XgFq6 PZyQ== X-Gm-Message-State: AJaThX5G4kCtVsNUeltgiV8oSzVhz3LnIGwIWrsQR9hF/Q5QrDZzzeP0 5YK8F1DEoZhJTUc9J3BAuJl9bS52MI0PSzweXeLN5cSSwbH7DIV6wxMcuqHTUkBiDQUzU91hrWT O5uL+we/HMOdmoIGsscl6vQhb4Up3BVdZkiNgi/PIJHRE4D7PYO4aRUjY4AZGtgTwzQeW3you4R kItFFW96bn X-Google-Smtp-Source: AGs4zMYG4Fki8XiW8mDcvC4fmMfm/gnks1RqpTH37magEA3HAp1j2Utv/6d33UCkK+1NYIaFO87qXA== X-Received: by 10.28.212.74 with SMTP id l71mr430648wmg.33.1511894320286; Tue, 28 Nov 2017 10:38:40 -0800 (PST) Received: from [10.137.2.19] (ip-78-102-97-226.net.upcbroadband.cz. [78.102.97.226]) by smtp.gmail.com with ESMTPSA id o27sm6734245wro.9.2017.11.28.10.38.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Nov 2017 10:38:39 -0800 (PST) Subject: Re: large numbers of inserts out of memory strategy To: Ted Toth Cc: pgsql-general References: <87d5d3c9-66e4-c29d-bece-79f2909cccb9@2ndquadrant.com> From: Tomas Vondra Message-ID: <8431416a-2ab2-d580-19bd-2c7e3353960d@2ndquadrant.com> Date: Tue, 28 Nov 2017 19:38:37 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 11/28/2017 07:26 PM, Ted Toth wrote: > On Tue, Nov 28, 2017 at 12:01 PM, Tomas Vondra > wrote: >> >> ... >> >> That is, most of the memory is allocated for SPI (2.4GB) and PL/pgSQL >> procedure (500MB). How do you do the load? What libraries/drivers? >> > > I'm doing the load with 'psql -f'. I using 9.6 el6 rpms on a Centos VM > I downloaded from the postgres repo. > So what does the script actually do? Because psql certainly is not running pl/pgsql procedures on it's own. We need to understand why you're getting OOM in the first place - just inserts alone should not cause failures like that. Please show us more detailed explanation of what the load actually does, so that we can try reproducing it. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services