{"id":16673,"date":"2021-09-08T17:42:03","date_gmt":"2021-09-08T15:42:03","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/how-much-shared-memory-is-postgresql-using-1-basics\/"},"modified":"2021-09-08T17:42:03","modified_gmt":"2021-09-08T15:42:03","slug":"how-much-shared-memory-is-postgresql-using-1-basics","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/how-much-shared-memory-is-postgresql-using-1-basics\/","title":{"rendered":"How much shared memory is PostgreSQL using? (1) &#8211; basics"},"content":{"rendered":"<p>Have you ever wondered if the value of <a href=\"https:\/\/www.postgresql.org\/docs\/current\/runtime-config-resource.html#shared_buffers\" target=\"_blank\" rel=\"noopener\">shared_buffers<\/a> is the only setting which controls how much shared memory PostgreSQL is actually using? There was a nice addition committed to PostgreSQL 15 recently, which helps in answering this question (more on that later). <a href=\"https:\/\/www.postgresql.org\/docs\/current\/runtime-config-resource.html#shared_buffers\" target=\"_blank\" rel=\"noopener\">shared_buffers<\/a> for sure is the biggest chunk of shared memory that PostgreSQL is using but there might be other factors which come into the game. You might ask yourself why that is important and one bit you need to keep in mind are <a href=\"https:\/\/www.postgresql.org\/docs\/13\/kernel-resources.html#LINUX-HUGE-PAGES\" target=\"_blank\" rel=\"noopener\">huge pages<\/a>. Those need to be calculated by you and provided by the operating system for PostgreSQL being able to use them. In the default configuration of PostgreSQL you might not even notice that the number of huge pages provided by the OS are not sufficient. PostgreSQL will happily start and you&#8217;ll probably never notice that huge pages are not used at all.<\/p>\n<p><!--more--><\/p>\n<p>Let&#8217;s start with the default configuration on Linux: shared_buffers=128MB:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">\npostgres=# show shared_buffers;\n shared_buffers \n----------------\n 128MB\n(1 row)\n<\/pre>\n<p>The default page size on Linux is 4kB:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\npostgres@debian11pg:\/home\/postgres\/ [pgdev] getconf PAGESIZE\n4096\n<\/pre>\n<p>This means all memory is allocated in chunks of 4kB. The default huge page size on Linux is 2MB:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\npostgres@debian11pg:\/home\/postgres\/ [pgdev] grep Hugepagesize \/proc\/meminfo \nHugepagesize:       2048 kB\n<\/pre>\n<p>The benefit of switching to huge pages should already be clear now: Instead of allocating 32768 ((128*1024)\/4) pages of memory it will be only 64 ((128*1024)\/2048) with huge pages, so much less effort to manage those lists.<\/p>\n<p>If shared buffers are the only bit to consider we should be able to start PostgreSQL with 64 huge pages provided by the operating system. Let&#8217;s try that and install <a href=\"https:\/\/tuned-project.org\/\" target=\"_blank\" rel=\"noopener\">tuned<\/a> for easier configuration of huge pages:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\npostgres@debian11pg:\/home\/postgres\/ [pgdev] sudo apt install tuned -y\n<\/pre>\n<p>I am not going into the details of tuned here (check the link above if you want to know more). The currently active profile in my case is this one:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\npostgres@debian11pg:\/home\/postgres\/ [pgdev] tuned-adm active\nCurrent active profile: virtual-guest\n<\/pre>\n<p>The default profiles are located here (you should create your own profiles for your specific needs under \/etc\/tuned, do not modify the default ones as they might be overwritten with the next system update):<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\npostgres@debian11pg:\/home\/postgres\/ [pgdev] ls \/usr\/lib\/tuned\/\naccelerator-performance  defirqaffinity.py   intel-sst                 network-throughput       realtime                server-powersave\natomic-guest             desktop             laptop-ac-powersave       optimize-serial-console  realtime-virtual-guest  spectrumscale-ece\natomic-host              desktop-powersave   laptop-battery-powersave  oracle                   realtime-virtual-host   spindown-disk\nbalanced                 enterprise-storage  latency-performance       postgresql               recommend.d             throughput-performance\ncpu-partitioning         functions           mssql                     powersave                sap-hana                virtual-guest\ndefault                  hpc-compute         network-latency           __pycache__              sap-netweaver           virtual-host\n<\/pre>\n<p>Another way to get the available profiles is this:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\npostgres@debian11pg:\/home\/postgres\/ [pgdev] tuned-adm list\nAvailable profiles:\n- accelerator-performance     - Throughput performance based tuning with disabled higher latency STOP states\n- atomic-guest                - Optimize virtual guests based on the Atomic variant\n- atomic-host                 - Optimize bare metal systems running the Atomic variant\n- balanced                    - General non-specialized tuned profile\n- cpu-partitioning            - Optimize for CPU partitioning\n- default                     - Legacy default tuned profile\n- desktop                     - Optimize for the desktop use-case\n- desktop-powersave           - Optmize for the desktop use-case with power saving\n- enterprise-storage          - Legacy profile for RHEL6, for RHEL7, please use throughput-performance profile\n- hpc-compute                 - Optimize for HPC compute workloads\n- intel-sst                   - Configure for Intel Speed Select Base Frequency\n- laptop-ac-powersave         - Optimize for laptop with power savings\n- laptop-battery-powersave    - Optimize laptop profile with more aggressive power saving\n- latency-performance         - Optimize for deterministic performance at the cost of increased power consumption\n- mssql                       - Optimize for MS SQL Server\n- network-latency             - Optimize for deterministic performance at the cost of increased power consumption, focused on low latency network performance\n- network-throughput          - Optimize for streaming network throughput, generally only necessary on older CPUs or 40G+ networks\n- optimize-serial-console     - Optimize for serial console use.\n- oracle                      - Optimize for Oracle RDBMS\n- postgresql                  - Optimize for PostgreSQL server\n- powersave                   - Optimize for low power consumption\n- realtime                    - Optimize for realtime workloads\n- realtime-virtual-guest      - Optimize for realtime workloads running within a KVM guest\n- realtime-virtual-host       - Optimize for KVM guests running realtime workloads\n- sap-hana                    - Optimize for SAP HANA\n- sap-netweaver               - Optimize for SAP NetWeaver\n- server-powersave            - Optimize for server power savings\n- spectrumscale-ece           - Optimized for Spectrum Scale Erasure Code Edition Servers\n- spindown-disk               - Optimize for power saving by spinning-down rotational disks\n- throughput-performance      - Broadly applicable tuning that provides excellent performance across a variety of common server workloads\n- virtual-guest               - Optimize for running inside a virtual guest\n- virtual-host                - Optimize for running KVM guests\nCurrent active profile: virtual-guest\n<\/pre>\n<p>As I am currently using the &#8220;virtual-guest&#8221; profile let&#8217;s add the calculated number of huge pages to that profile and then make the system re-apply the settings:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\npostgres@debian11pg:\/home\/postgres\/ [pgdev] echo \"vm.nr_hugepages=64\" | sudo tee -a \/usr\/lib\/tuned\/virtual-guest\/tuned.conf\nvm.nr_hugepages=64\npostgres@debian11pg:\/home\/postgres\/ [pgdev] sudo tuned-adm profile virtual-guest\npostgres@debian11pg:\/home\/postgres\/ [pgdev] egrep \"HugePages_Total|HugePages_Free\" \/proc\/meminfo \nHugePages_Total:      64\nHugePages_Free:       64\n<\/pre>\n<p>This confirms that we now have 64 huge pages available of which all are free currently. Will PostgreSQL use any of those if we restart?<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\npostgres@debian11pg:\/home\/postgres\/ [pgdev] pg_ctl stop\npostgres@debian11pg:\/home\/postgres\/ [pgdev] pg_ctl start\npostgres@debian11pg:\/home\/postgres\/ [pgdev] egrep \"HugePages_Total|HugePages_Free\" \/proc\/meminfo \nHugePages_Total:      64\nHugePages_Free:       64\n<\/pre>\n<p>No, not at all. Lets try to force it by setting <a href=\"https:\/\/www.postgresql.org\/docs\/current\/runtime-config-resource.html\" target=\"_blank\" rel=\"noopener\">huge_pages<\/a> to &#8220;on&#8221;. By doing this PostgreSQL will not start if there are not enough huge pages available (the default is &#8220;try&#8221;):<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\npostgres@debian11pg:\/home\/postgres\/ [pgdev] psql -c \"alter system set huge_pages=on\" \nALTER SYSTEM\n19:12:28 postgres@debian11pg:\/home\/postgres\/ [pgdev] pg_ctl stop\n19:12:34 postgres@debian11pg:\/home\/postgres\/ [pgdev] pg_ctl start\nwaiting for server to start....2021-09-08 19:12:36.508 CEST [2542] FATAL:  could not map anonymous shared memory: Cannot allocate memory\n2021-09-08 19:12:36.508 CEST [2542] HINT:  This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory, swap space, or huge pages. To reduce the request size (currently 148897792 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections.\n2021-09-08 19:12:36.508 CEST [2542] LOG:  database system is shut down\n stopped waiting\npg_ctl: could not start server\nExamine the log output.\n<\/pre>\n<p>Why is that? If you follow the <a href=\"https:\/\/www.postgresql.org\/docs\/current\/kernel-resources.html#LINUX-HUGE-PAGES\" target=\"_blank\" rel=\"noopener\">official documentation<\/a> for calculating huge pages on Linux, you&#8217;ll notice that the procedure is slightly more complicated:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\npostgres@debian11pg:\/home\/postgres\/ [pgdev] cat \/dev\/null &gt; $PGDATA\/postgresql.auto.conf\npostgres@debian11pg:\/home\/postgres\/ [pgdev] pg_ctl start\npostgres@debian11pg:\/home\/postgres\/ [pgdev] pmap 2573 | awk '\/rw-s\/ &amp;&amp; \/zero\/ {print $2}'\n145360K\npostgres@debian11pg:\/home\/postgres\/ [pgdev] echo \"145360\/2048\" | bc\n70\n<\/pre>\n<p>This is 6 more than what we calculated above and confirms that shared buffers is not the only setting to consider. Anyway, lets try with this value:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\npostgres@debian11pg:\/home\/postgres\/ [pgdev] psql -c \"alter system set huge_pages=on\" \nALTER SYSTEM\npostgres@debian11pg:\/home\/postgres\/ [pgdev] sudo sed -i 's\/64\/70\/g' \/usr\/lib\/tuned\/virtual-guest\/tuned.conf\npostgres@debian11pg:\/home\/postgres\/ [pgdev] sudo tuned-adm profile virtual-guest\npostgres@debian11pg:\/home\/postgres\/ [pgdev] egrep \"HugePages_Total|HugePages_Free\" \/proc\/meminfo \nHugePages_Total:      70\nHugePages_Free:       70\n<\/pre>\n<p>Will this work?<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\npostgres@debian11pg:\/home\/postgres\/ [pgdev] pg_ctl stop\npostgres@debian11pg:\/home\/postgres\/ [pgdev] pg_ctl start\nwaiting for server to start....2021-09-08 19:23:57.097 CEST [2618] FATAL:  could not map anonymous shared memory: Cannot allocate memory\n2021-09-08 19:23:57.097 CEST [2618] HINT:  This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory, swap space, or huge pages. To reduce the request size (currently 148897792 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections.\n2021-09-08 19:23:57.097 CEST [2618] LOG:  database system is shut down\n stopped waiting\npg_ctl: could not start server\nExamine the log output.\n<\/pre>\n<p>No. Add one more and you&#8217;ll be fine:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\npostgres@debian11pg:\/home\/postgres\/ [pgdev] sudo sed -i 's\/70\/71\/g' \/usr\/lib\/tuned\/virtual-guest\/tuned.conf\npostgres@debian11pg:\/home\/postgres\/ [pgdev] sudo tuned-adm profile virtual-guest\npostgres@debian11pg:\/home\/postgres\/ [pgdev] pg_ctl start\nwaiting for server to start....2021-09-08 19:25:11.393 CEST [2633] LOG:  starting PostgreSQL 15devel on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit\n2021-09-08 19:25:11.395 CEST [2633] LOG:  listening on IPv6 address \"::1\", port 5432\n2021-09-08 19:25:11.395 CEST [2633] LOG:  listening on IPv4 address \"127.0.0.1\", port 5432\n2021-09-08 19:25:11.413 CEST [2633] LOG:  listening on Unix socket \"\/tmp\/.s.PGSQL.5432\"\n2021-09-08 19:25:11.443 CEST [2636] LOG:  database system was shut down at 2021-09-08 19:23:55 CEST\n2021-09-08 19:25:11.462 CEST [2633] LOG:  database system is ready to accept connections\n done\nserver started\n<\/pre>\n<p>Why? Because 145360\/2048 gives 70.9765625 exactly, so you&#8217;ll need 71 instead of 70. <\/p>\n<p>That&#8217;s it for the basics, things to remember:<\/p>\n<ul>\n<li>shared_buffers is not the only configuration you need to take into account for configuring huge pages<\/li>\n<li>tuned is a nice and easy way to deal with system\/kernel configurations, and it is available on <a href=\"https:\/\/www.debian.org\/\" target=\"_blank\" rel=\"noopener\">Debian<\/a> as well<\/li>\n<li>the official way of configuring huge pages for PostgreSQL works, but there is more to know for doing it correctly<\/li>\n<\/ul>\n<p>In the next post will dig into more details about which configurations change the shared memory requirements for PostgreSQL.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Have you ever wondered if the value of shared_buffers is the only setting which controls how much shared memory PostgreSQL is actually using? There was a nice addition committed to PostgreSQL 15 recently, which helps in answering this question (more on that later). shared_buffers for sure is the biggest chunk of shared memory that PostgreSQL [&hellip;]<\/p>\n","protected":false},"author":29,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[229],"tags":[77],"type_dbi":[],"class_list":["post-16673","post","type-post","status-publish","format-standard","hentry","category-database-administration-monitoring","tag-postgresql"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How much shared memory is PostgreSQL using? (1) - basics - dbi Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/how-much-shared-memory-is-postgresql-using-1-basics\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How much shared memory is PostgreSQL using? (1) - basics\" \/>\n<meta property=\"og:description\" content=\"Have you ever wondered if the value of shared_buffers is the only setting which controls how much shared memory PostgreSQL is actually using? There was a nice addition committed to PostgreSQL 15 recently, which helps in answering this question (more on that later). shared_buffers for sure is the biggest chunk of shared memory that PostgreSQL [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/how-much-shared-memory-is-postgresql-using-1-basics\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2021-09-08T15:42:03+00:00\" \/>\n<meta name=\"author\" content=\"Daniel Westermann\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@westermanndanie\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Daniel Westermann\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/how-much-shared-memory-is-postgresql-using-1-basics\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/how-much-shared-memory-is-postgresql-using-1-basics\/\"},\"author\":{\"name\":\"Daniel Westermann\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d08e9bd996a89bd75c0286cbabf3c66\"},\"headline\":\"How much shared memory is PostgreSQL using? (1) &#8211; basics\",\"datePublished\":\"2021-09-08T15:42:03+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/how-much-shared-memory-is-postgresql-using-1-basics\/\"},\"wordCount\":588,\"commentCount\":0,\"keywords\":[\"PostgreSQL\"],\"articleSection\":[\"Database Administration &amp; Monitoring\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/how-much-shared-memory-is-postgresql-using-1-basics\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/how-much-shared-memory-is-postgresql-using-1-basics\/\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/how-much-shared-memory-is-postgresql-using-1-basics\/\",\"name\":\"How much shared memory is PostgreSQL using? (1) - basics - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\"},\"datePublished\":\"2021-09-08T15:42:03+00:00\",\"author\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d08e9bd996a89bd75c0286cbabf3c66\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/how-much-shared-memory-is-postgresql-using-1-basics\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/how-much-shared-memory-is-postgresql-using-1-basics\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/how-much-shared-memory-is-postgresql-using-1-basics\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.dbi-services.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How much shared memory is PostgreSQL using? (1) &#8211; basics\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d08e9bd996a89bd75c0286cbabf3c66\",\"name\":\"Daniel Westermann\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/31350ceeecb1dd8986339a29bf040d4cd3cd087d410deccd8f55234466d6c317?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/31350ceeecb1dd8986339a29bf040d4cd3cd087d410deccd8f55234466d6c317?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/31350ceeecb1dd8986339a29bf040d4cd3cd087d410deccd8f55234466d6c317?s=96&d=mm&r=g\",\"caption\":\"Daniel Westermann\"},\"description\":\"Daniel Westermann is Principal Consultant and Technology Leader Open Infrastructure at dbi services. He has more than 15 years of experience in management, engineering and optimization of databases and infrastructures, especially on Oracle and PostgreSQL. Since the beginning of his career, he has specialized in Oracle Technologies and is Oracle Certified Professional 12c and Oracle Certified Expert RAC\/GridInfra. Over time, Daniel has become increasingly interested in open source technologies, becoming \u201cTechnology Leader Open Infrastructure\u201d and PostgreSQL expert. \u00a0Based on community or EnterpriseDB tools, he develops and installs complex high available solutions with PostgreSQL. He is also a certified PostgreSQL Plus 9.0 Professional and a Postgres Advanced Server 9.4 Professional. He is a regular speaker at PostgreSQL conferences in Switzerland and Europe. Today Daniel is also supporting our customers on AWS services such as AWS RDS, database migrations into the cloud, EC2 and automated infrastructure management with AWS SSM (System Manager). He is a certified AWS Solutions Architect Professional. Prior to dbi services, Daniel was Management System Engineer at LC SYSTEMS-Engineering AG in Basel. Before that, he worked as Oracle Developper &amp;\u00a0Project Manager at Delta Energy Solutions AG in Basel (today Powel AG). Daniel holds a diploma in Business Informatics (DHBW, Germany). His branch-related experience mainly covers the pharma industry, the financial sector, energy, lottery and telecommunications.\",\"sameAs\":[\"https:\/\/x.com\/westermanndanie\"],\"url\":\"https:\/\/www.dbi-services.com\/blog\/author\/daniel-westermann\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How much shared memory is PostgreSQL using? (1) - basics - dbi Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/how-much-shared-memory-is-postgresql-using-1-basics\/","og_locale":"en_US","og_type":"article","og_title":"How much shared memory is PostgreSQL using? (1) - basics","og_description":"Have you ever wondered if the value of shared_buffers is the only setting which controls how much shared memory PostgreSQL is actually using? There was a nice addition committed to PostgreSQL 15 recently, which helps in answering this question (more on that later). shared_buffers for sure is the biggest chunk of shared memory that PostgreSQL [&hellip;]","og_url":"https:\/\/www.dbi-services.com\/blog\/how-much-shared-memory-is-postgresql-using-1-basics\/","og_site_name":"dbi Blog","article_published_time":"2021-09-08T15:42:03+00:00","author":"Daniel Westermann","twitter_card":"summary_large_image","twitter_creator":"@westermanndanie","twitter_misc":{"Written by":"Daniel Westermann","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/how-much-shared-memory-is-postgresql-using-1-basics\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/how-much-shared-memory-is-postgresql-using-1-basics\/"},"author":{"name":"Daniel Westermann","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d08e9bd996a89bd75c0286cbabf3c66"},"headline":"How much shared memory is PostgreSQL using? (1) &#8211; basics","datePublished":"2021-09-08T15:42:03+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/how-much-shared-memory-is-postgresql-using-1-basics\/"},"wordCount":588,"commentCount":0,"keywords":["PostgreSQL"],"articleSection":["Database Administration &amp; Monitoring"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/how-much-shared-memory-is-postgresql-using-1-basics\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/how-much-shared-memory-is-postgresql-using-1-basics\/","url":"https:\/\/www.dbi-services.com\/blog\/how-much-shared-memory-is-postgresql-using-1-basics\/","name":"How much shared memory is PostgreSQL using? (1) - basics - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"datePublished":"2021-09-08T15:42:03+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d08e9bd996a89bd75c0286cbabf3c66"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/how-much-shared-memory-is-postgresql-using-1-basics\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/how-much-shared-memory-is-postgresql-using-1-basics\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/how-much-shared-memory-is-postgresql-using-1-basics\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How much shared memory is PostgreSQL using? (1) &#8211; basics"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d08e9bd996a89bd75c0286cbabf3c66","name":"Daniel Westermann","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/31350ceeecb1dd8986339a29bf040d4cd3cd087d410deccd8f55234466d6c317?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/31350ceeecb1dd8986339a29bf040d4cd3cd087d410deccd8f55234466d6c317?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/31350ceeecb1dd8986339a29bf040d4cd3cd087d410deccd8f55234466d6c317?s=96&d=mm&r=g","caption":"Daniel Westermann"},"description":"Daniel Westermann is Principal Consultant and Technology Leader Open Infrastructure at dbi services. He has more than 15 years of experience in management, engineering and optimization of databases and infrastructures, especially on Oracle and PostgreSQL. Since the beginning of his career, he has specialized in Oracle Technologies and is Oracle Certified Professional 12c and Oracle Certified Expert RAC\/GridInfra. Over time, Daniel has become increasingly interested in open source technologies, becoming \u201cTechnology Leader Open Infrastructure\u201d and PostgreSQL expert. \u00a0Based on community or EnterpriseDB tools, he develops and installs complex high available solutions with PostgreSQL. He is also a certified PostgreSQL Plus 9.0 Professional and a Postgres Advanced Server 9.4 Professional. He is a regular speaker at PostgreSQL conferences in Switzerland and Europe. Today Daniel is also supporting our customers on AWS services such as AWS RDS, database migrations into the cloud, EC2 and automated infrastructure management with AWS SSM (System Manager). He is a certified AWS Solutions Architect Professional. Prior to dbi services, Daniel was Management System Engineer at LC SYSTEMS-Engineering AG in Basel. Before that, he worked as Oracle Developper &amp;\u00a0Project Manager at Delta Energy Solutions AG in Basel (today Powel AG). Daniel holds a diploma in Business Informatics (DHBW, Germany). His branch-related experience mainly covers the pharma industry, the financial sector, energy, lottery and telecommunications.","sameAs":["https:\/\/x.com\/westermanndanie"],"url":"https:\/\/www.dbi-services.com\/blog\/author\/daniel-westermann\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/16673","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/29"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=16673"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/16673\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=16673"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=16673"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=16673"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=16673"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}