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 1hko2Q-0000OI-4v for pgsql-general@arkaria.postgresql.org; Tue, 09 Jul 2019 11:11:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hko2P-0007Z7-13 for pgsql-general@arkaria.postgresql.org; Tue, 09 Jul 2019 11:11:57 +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 1hko2O-0007Yz-IH for pgsql-general@lists.postgresql.org; Tue, 09 Jul 2019 11:11:56 +0000 Received: from mail-lf1-x141.google.com ([2a00:1450:4864:20::141]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hko2M-00048B-4C for pgsql-general@postgresql.org; Tue, 09 Jul 2019 11:11:55 +0000 Received: by mail-lf1-x141.google.com with SMTP id b29so13169137lfq.1 for ; Tue, 09 Jul 2019 04:11:53 -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=gVL4RN9Kw8qPjqwvBdbcf8+sn+u80D8MdA3wYfdFnDg=; b=d28or+wyLRrpxiIvloAtnW+SktA+4p12BNzDJD295eRANcwJeTdZjoDWTtSsiHsG5L WmgIVtP3CC4oT6EJJwmDTBgmQzBz0zIvyqRAu6JzIWoDJzxUwGxets4+7u7WiLAenZS0 0DWgvTJZyT9WsNzvOEXRpL47rm8WibxBH40l2FvNSCNTLsJbE/YeLGDByUpaZBynC9BH 7Q7+PDDTZ4zjAL2CgX1rFZ0o2sATHvjBYT3IQFjeb7fwmTs7GmR8ox4uKvK2gn+RzZyI 85zr6ZWVBwpWDdgXIEzeCRT513xiV2gLC+ihfaxEKqGGmAlb/nT7pUKjFK3WKPsgWEAb +kDw== 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=gVL4RN9Kw8qPjqwvBdbcf8+sn+u80D8MdA3wYfdFnDg=; b=SB7vO1JKYW7sboDQOtPHgi21DR6Pj3jFowLpG6xVxES9HtnSIp062TIYJ6D/qtuCzk BbucvQ1ZNz7Yku0MbyFRC59BYLrQBJwj6ouiCc5Vf91GevQH2jNeHoNMz1yAgaiAAV1V NB4EkavcaeQ41u0t6Ey1d7Q97kFlMl8AdnpaPZ3eU8c5gV0zdHdKBA3f1rOoHaWYicpL /KkF7w8ctsTdXGFOdvjdJm1iuFzK2vzl8EE1DxdzB57Jy3HRji8iP5VyJYqe4sr0FeK0 FRlboekfs5fCB+9PViYlTOHazU50BdoABzW/z2Z5N3Y7+oaU2bgNceOSxkfXfaAKVzVy 1h3A== X-Gm-Message-State: APjAAAVGt5irHZ6scDCPM/qn5Sq5OcKJACVrF0vbEQ89Ka1nWTFvwJpi /aCHeI9KLIsst0+CR9+IJbU= X-Google-Smtp-Source: APXvYqzn4G6BxcHwu8qKRKzW1cq7k34RazvvvvG57D+PWJGSyVo9AfAvNrL4mEh4xBTL3W52nhScKA== X-Received: by 2002:a19:ca0d:: with SMTP id a13mr11004451lfg.110.1562670712316; Tue, 09 Jul 2019 04:11:52 -0700 (PDT) Received: from [172.20.1.244] ([93.180.21.1]) by smtp.gmail.com with ESMTPSA id c30sm3278380lfp.70.2019.07.09.04.11.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jul 2019 04:11:51 -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 14:11:50 +0300 Cc: Jean Louis , pgsql-general Content-Transfer-Encoding: quoted-printable Message-Id: <825554F8-7D18-4DFA-B01F-5F3A47A66749@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> 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 Hello Thomas, Thank you for explanation. work_mem =3D 512MB and = max_parallel_workers_per_gather =3D 2 and I run only one Postgres = instance and only one query. EXPLAIN shows "Workers Planned: 2" for this = query. Why it can use more than 1GB of /dev/shm? Konstantin > On 9 Jul 2019, at 13:51, Thomas Munro wrote: >=20 > On Tue, Jul 9, 2019 at 10:15 PM Jean Louis wrote: >> * Konstantin Malanchev [2019-07-09 12:10]: >>> I have 8 GB RAM and /dev/shm size is 4GB, and there is no = significant memory usage by other system processes. I surprised that = Postgres uses more space in /dev/shm than sharred_buffers parameter = allows, probably I don't understand what this parameter means. >>>=20 >>> I have no opportunity to enlarge total RAM and probably this query = requires too much RAM to execute. Should Postgres just use HDD as = temporary storage in this case? >>=20 >> That I cannot know. I know that /dev/shm could >> grow as much as available free RAM. >=20 > Hi, >=20 > PostgreSQL creates segments in /dev/shm for parallel queries (via > shm_open()), not for shared buffers. The amount used is controlled by > work_mem. Queries can use up to work_mem for each node you see in the > EXPLAIN plan, and for each process, so it can be quite a lot if you > have lots of parallel worker processes and/or lots of > tables/partitions being sorted or hashed in your query. >=20 > --=20 > Thomas Munro > https://enterprisedb.com