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 1hkpE3-000416-IH for pgsql-general@arkaria.postgresql.org; Tue, 09 Jul 2019 12:28:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hkpE2-0001ZA-EA for pgsql-general@arkaria.postgresql.org; Tue, 09 Jul 2019 12:28:02 +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 1hkpE1-0001Xm-VW for pgsql-general@lists.postgresql.org; Tue, 09 Jul 2019 12:28:02 +0000 Received: from mail-lj1-x243.google.com ([2a00:1450:4864:20::243]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hkpDz-0004n2-Nx for pgsql-general@postgresql.org; Tue, 09 Jul 2019 12:28:00 +0000 Received: by mail-lj1-x243.google.com with SMTP id k18so19355839ljc.11 for ; Tue, 09 Jul 2019 05:27:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=oSxBNJEToixFNfhnlPQWiIRTuflGglAkSlzEdz1TzfA=; b=lDRwO07D2EVZ6GyydkY/vjPzlBg2sCRY3n+68CaiSOjJ93aYxXKMw4jkkTlS/AXfRm fnoCpHrj4hpQF/xykKp/ZI5nbk9564FvJI49lg/mshYnK5RcRyaQpvttQOxpFTu/u+N6 +ESX2q9jDKzLJw1Wu4AARkwfl5L0bhdCPOrra5ppxvMkF+96flp64tWmRbCHIH34KoFU rM2vSSXOC2mTdR4+8e1EfI0WhWLg6iDvYi7CiDHccZEbMQdnMG7IWQamcyQ9a3cAbdwM lyCO4CJSLlVAC6iO63cfo0EaXyUXg+xjIF9Per4HCrQM/oqq2f5bS/jdGXfdQDlEau7f ZLUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=oSxBNJEToixFNfhnlPQWiIRTuflGglAkSlzEdz1TzfA=; b=O97GrNREMBe5ypNpMn8uB1fKsjxgT47K2aq7ztH4/WhudLD6uso/mEwiusiSjVos2g s9/X2hkjSzKfo+LfPyj+t3ChyeUDUhtwVFuHP8T/1hhb69vfjT1gTwAXYz5TT1PiAmPE MB5spkc/rrxyNXtn/f0SsumEnM/jvUovxP69ABKlmsSpcKjmQ0tvu2UHtydwlhU5HLlu JzavX2Lo//ZW86CRBXBANrRTE7F707sjuaBnsN7mw+pYi/0dAMWwoSyX/yrk6r8i/ylL GGjLZqk/F+k2j5+wHMVZJIoHar7y5mPRMSIaBdM3vQ17Zrei8I9jAJ5KG2tL6wLsqCCS vV4Q== X-Gm-Message-State: APjAAAVaETJg+Ou0p0jwdbOO10+FwUXcXWfk3R0cF8/g1lu6wKXPUbNM gZmJI5/Jr9dCwHuOkJPtmDo= X-Google-Smtp-Source: APXvYqwZcPM/pHxoT665GxQ45vaQGxOfciDYRmWx3BdKaAZCq/kA8wTGY/vF2DdO5rjUzWdXh2ADaA== X-Received: by 2002:a2e:80c8:: with SMTP id r8mr13727712ljg.168.1562675278160; Tue, 09 Jul 2019 05:27:58 -0700 (PDT) Received: from [172.20.1.244] ([93.180.21.1]) by smtp.gmail.com with ESMTPSA id d21sm2505516lfc.73.2019.07.09.05.27.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jul 2019 05:27:57 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: PGSQL 11.4: shared_buffers and /dev/shm size From: Konstantin Malanchev In-Reply-To: Date: Tue, 9 Jul 2019 15:27:56 +0300 Cc: Jean Louis , pgsql-general Content-Transfer-Encoding: quoted-printable Message-Id: <2A639837-888D-474F-AE91-8BBB65952D70@gmail.com> References: <7E4D7DA4-E093-4F6A-AE8E-81A73B995A8D@gmail.com> <20190709095344.GK7323@protected.rcdrun.com> <63682227-874F-43A9-8879-DE875DE9BCC3@gmail.com> <20190709101514.GB10233@protected.rcdrun.com> <825554F8-7D18-4DFA-B01F-5F3A47A66749@gmail.com> To: Thomas Munro X-Mailer: Apple Mail (2.3445.104.11) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Thank you! > For example, if you have one Parallel Hash Join in your plan, it could > allocate up to 512MB * 3 of shared memory (3 =3D leader process + 2 > workers). I'm executing the query with smaller work_mem, it will take some time. = But I still confused why it used all /dev/shm (4GB) and fails with "no = space left" error while work_mem =3D 512MB. > If you > run EXPLAIN ANALYZE you'll see how much memory is used by individual > operations. I cannot run EXPLAIN ANALYSE, because the query fails. This is = explanation for the query: EXPLAIN CREATE MATERIALIZED VIEW IF NOT EXISTS new_mat_view AS SELECT * FROM my_view INNER JOIN another_mat_view USING (oid) ORDER BY oid, field_name; Gather Merge (cost=3D5696039356565.87..10040767101103.24 = rows=3D37237923518438 width=3D31) Workers Planned: 2 -> Sort (cost=3D5696039355565.85..5742586759963.90 = rows=3D18618961759219 width=3D31) Sort Key: my_table.oid, my_table.field_name -> Parallel Hash Join (cost=3D11030236131.39..255829470118.27 = rows=3D18618961759219 width=3D31) Hash Cond: (another_mat_view.oid =3D my_table.oid) -> Parallel Seq Scan on another_mat_view = (cost=3D0.00..652514.56 rows=3D31645556 width=3D8) -> Parallel Hash (cost=3D636676233.38..636676233.38 = rows=3D20353804801 width=3D31) -> Parallel Seq Scan on my_table = (cost=3D0.00..636676233.38 rows=3D20353804801 width=3D31) Filter: (flag =3D = '0000000000000000'::bit(16)) Konstantin=