Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gHOAl-000202-Bd for pgsql-general@arkaria.postgresql.org; Tue, 30 Oct 2018 07:10:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gHOAj-0003mI-1H for pgsql-general@arkaria.postgresql.org; Tue, 30 Oct 2018 07:10:41 +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.89) (envelope-from ) id 1gHOAi-0003mA-P3 for pgsql-general@lists.postgresql.org; Tue, 30 Oct 2018 07:10:40 +0000 Received: from mout.kundenserver.de ([217.72.192.75]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gHOAg-0005IO-Oo for pgsql-general@lists.postgresql.org; Tue, 30 Oct 2018 07:10:40 +0000 Received: from [10.8.0.146] ([185.40.248.10]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.145]) with ESMTPSA (Nemesis) id 1MCsDe-1gQDrH3SaG-008sQZ for ; Tue, 30 Oct 2018 08:10:35 +0100 Received: from [10.8.0.146] ([185.40.248.10]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.145]) with ESMTPSA (Nemesis) id 1MCsDe-1gQDrH3SaG-008sQZ for ; Tue, 30 Oct 2018 08:10:35 +0100 Subject: Re: Different memory allocation strategy in Postgres 11? To: pgsql-general@lists.postgresql.org Newsgroups: gmane.comp.db.postgresql.general References: <06c3eb1f-4317-4c61-1038-fbc5ec76b0fa@gmx.net> From: Thomas Kellerer Message-ID: <96bfc389-120c-8e7e-b9aa-6dc70f2b03a4@gmx.net> Date: Tue, 30 Oct 2018 08:10:34 +0100 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:W1V3XwxXuHrN7pvItTVJkm9220Qju3jnU6JB757RKB0UNDKcw4I DevvyrUJWDJEYin0J9Ix9ekRxzDkOzBDFpIF5YnC9/EZlgmdbVsW3q54y3+HTzugG5a26My 7YtLMmEJxa9LovjM1LKzxDXp/1zEpA4QGg0SaELweS2vUDt9+rHhY6X3peERjwy+H2Kk1rL ulXEv7cWSegc3G327T/uw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V01:K0:7JfLDvltkag=:Cvc+zDYU3PVP1BevIUChWd 69q8gfkWm6RlLtyeg6HPW2dD82b4U2IvNcva9DLsItM6r8bL5Psx5b2WdpKHs8gSVt+KyKYU1 Nl9XcZU5XqBJJTsr65QXRbo+V6YSasjS3Hexg7pbbMh873d+OybDUhaZ1vfTNy60rPqDNPgBL J5krr6rBdbAa0EOT3Os85DIigpl9tiD0RZscX7l7JPJhJ4EFJl3yP9fKA0ilhNQ3krWQkChgQ Nplseyl3DrFYI7xYmPAg7xinHk/ywsKaFxV6mVKKp793SJ0+d+4Ur5g0W2TLyEoH0kxePKS3/ HswwLnlLpQwfVIcBwXheI95aIEIr191fHvsuYU+VpvEZsjpkFf9NRzzQOO3WNxAdQKxF01kpx voQM9faZjzDUZcd58eJo75/U2V1EMtr8YmSlAF3iqFypHGX8qwDXByQ6CkOAGKC0JXPRUQiSw 1hlsEEWrdFnmwqscLsyjkZzz7X9f7EvKm256hEfh4LmhkqVK7dZevT7JLoq/HwDcwxlGS9ZBt S8uHZs1/EPb+KT59G5AH+/eJkfA/5lrKhLL9hzfsYPgtjpNRqcQ+vJEbgWhBteJOwvIzZsVi7 0DdmdIzlVILJYXozBZj6aW6eEKpa4c7e52sXzPHT/cD0IpljnzOxzjZ+u2dQbU5cL5QAo6Ayy uRKJlqPY+hy9jNVe0L2JBYwhg/dakm6GNyWrNFEGFuNWfCTupmm3U3FunjUSSrhGfj/UORuLN PcnteTexAICejzsT List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Thomas Munro schrieb am 26.10.2018 um 22:13: >>> I typically configure "shared_buffers = 4096MB" on my 16GB system as sometimes when testing, it pays off to have a bigger cache. >>> >>> With Postgres 10 and earlier, the Postgres process(es) would only allocate that memory from the operating system when needed. >>> So right after startup, it would only consume several hundred MB, not the entire 4GB >>> >>> However with Postgres 11 I noticed that it immediately grabs the complete memory configured for shared_buffers during startup. >>> >>> It's not really a big deal, but I wonder if that is an intentional change or a result from something else? >>> >>> >>> Do you have pg_prewarm in shared_preload_libraries? >> >> No. The only shared libraries are those for pg_stat_statemens > > Does your user have "Lock Pages in Memory" privilege? One thing that > is new in 11 is huge AKA large page support, and the default is > huge_pages=try. Not a Windows person myself but I believe that should > succeed if you have that privilege and enough contiguous chunks of > physical memory are available. If you set huge_pages=off does it > revert to the old behaviour? Turns out this was an "optimization" in Windows 10, and completely unrelated to Postgres. Windows 10 has a feature called "Fast Boot" (or something along the lines). When that is activated (which it is by default), a proper shutdown of the system does not seem to really shut it down. This is especially noteworthy with services: they don't get a shutdown event (which e.g. means even a service marked as "manual start", will still be running after a reboot if it did before) In case of Postgres this is visible e.g. in the logfile, because there will no shutdown or startup messages. So when I booted my laptop, Postgres continued where it was before the reboot - and the memory usage was caused caused by myself generating test data using generate_series() but I expected a "clean" state after the reboot. When manually restarting the service everything works as expected. Sorry for the noise.