{"id":13239,"date":"2024-06-10T13:19:26","date_gmt":"2024-06-10T13:19:26","guid":{"rendered":"https:\/\/www.bodhost.com\/kb\/?p=13239"},"modified":"2026-02-26T14:02:10","modified_gmt":"2026-02-26T14:02:10","slug":"how-to-check-the-size-of-postgresql-databases-tables-via-ssh","status":"publish","type":"post","link":"https:\/\/www.bodhost.com\/kb\/how-to-check-the-size-of-postgresql-databases-tables-via-ssh\/","title":{"rendered":"How to Check the Size of PostgreSQL Databases &#038; Tables via SSH"},"content":{"rendered":"<p>This guide shows you how to check the size of PostgreSQL databases and tables using the command line. You can utilize the \u2018psql\u2019 command-line tool to find the sizes of PostgreSQL databases and tables.<\/p>\n<p>Follow these steps-<\/p>\n<ol>\n<li>Log in to your account via SSH.<\/li>\n<li>At the command prompt, enter the following command, substituting dbname with your database name and username with your database username-<br \/>\npsql dbname username<\/li>\n<li>When prompted for a password, enter the password for the database user. After entering the correct password, the \u2018psql\u2019 prompt will appear.<\/li>\n<li>To find the size of a database, enter this command, replacing dbname with the name of the database you want to check-\n<pre>SELECT pg_size_pretty( pg_database_size('dbname') );<\/pre>\n<p>\u2018psql\u2019 will display the database size.<\/li>\n<li>To find the size of a table in the current database, enter this command, replacing tablename with the name of the table you want to check-\n<pre>SELECT pg_size_pretty( pg_total_relation_size('tablename') );<\/pre>\n<p>\u2018psql\u2019 will display the table size.<\/li>\n<\/ol>\n<p>Hope you liked our article. If you liked our article then you will surely love our support. Our support team is available for you around the clock. You can learn more about <a href=\"https:\/\/www.bodhost.com\/kb\/how-to-inspect-the-sizes-of-mysql-databases-and-tables\/\" target=\"_blank\" rel=\"noopener\">How to Inspect the Sizes of MySQL Databases and Tables<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This guide shows you how to check the size of PostgreSQL databases and tables using the command line. You can utilize the \u2018psql\u2019 command-line tool to find the sizes of&hellip;<\/p>\n<p><a href=\"https:\/\/www.bodhost.com\/kb\/how-to-check-the-size-of-postgresql-databases-tables-via-ssh\/\" class=\"more-link\">Read More<\/a><\/p>\n","protected":false},"author":21,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[836],"tags":[1538],"class_list":["post-13239","post","type-post","status-publish","format-standard","hentry","category-database","tag-postgresql-databases"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Check the Size of PostgreSQL Databases &amp; Tables via SSH<\/title>\n<meta name=\"description\" content=\"This guide will explain how to check the size of PostgreSQL Databases and Tables through Command line. Follow simple steps.\" \/>\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.bodhost.com\/kb\/how-to-check-the-size-of-postgresql-databases-tables-via-ssh\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Check the Size of PostgreSQL Databases &amp; Tables via SSH\" \/>\n<meta property=\"og:description\" content=\"This guide will explain how to check the size of PostgreSQL Databases and Tables through Command line. Follow simple steps.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.bodhost.com\/kb\/how-to-check-the-size-of-postgresql-databases-tables-via-ssh\/\" \/>\n<meta property=\"og:site_name\" content=\"Knowledge Base - bodHOST\" \/>\n<meta property=\"article:published_time\" content=\"2024-06-10T13:19:26+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-02-26T14:02:10+00:00\" \/>\n<meta name=\"author\" content=\"Serena\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Serena\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-check-the-size-of-postgresql-databases-tables-via-ssh\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-check-the-size-of-postgresql-databases-tables-via-ssh\\\/\"},\"author\":{\"name\":\"Serena\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/ffd3f118493c99471ae5bd4790a55830\"},\"headline\":\"How to Check the Size of PostgreSQL Databases &#038; Tables via SSH\",\"datePublished\":\"2024-06-10T13:19:26+00:00\",\"dateModified\":\"2026-02-26T14:02:10+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-check-the-size-of-postgresql-databases-tables-via-ssh\\\/\"},\"wordCount\":202,\"publisher\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#organization\"},\"keywords\":[\"PostgreSQL Databases\"],\"articleSection\":[\"Database\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-check-the-size-of-postgresql-databases-tables-via-ssh\\\/\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-check-the-size-of-postgresql-databases-tables-via-ssh\\\/\",\"name\":\"Check the Size of PostgreSQL Databases & Tables via SSH\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#website\"},\"datePublished\":\"2024-06-10T13:19:26+00:00\",\"dateModified\":\"2026-02-26T14:02:10+00:00\",\"description\":\"This guide will explain how to check the size of PostgreSQL Databases and Tables through Command line. Follow simple steps.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-check-the-size-of-postgresql-databases-tables-via-ssh\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-check-the-size-of-postgresql-databases-tables-via-ssh\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-check-the-size-of-postgresql-databases-tables-via-ssh\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Database\",\"item\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/category\\\/database\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Check the Size of PostgreSQL Databases &#038; Tables via SSH\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#website\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/\",\"name\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#organization\"},\"alternateName\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#organization\",\"name\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/wp-content\\\/uploads\\\/2025\\\/10\\\/Profile-Pic.png\",\"contentUrl\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/wp-content\\\/uploads\\\/2025\\\/10\\\/Profile-Pic.png\",\"width\":240,\"height\":240,\"caption\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\"},\"image\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/ffd3f118493c99471ae5bd4790a55830\",\"name\":\"Serena\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8bf3c9f6220a13a4d46295ad7c38a0c9e351ca3a57d0e417580c8e8b83a12a50?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8bf3c9f6220a13a4d46295ad7c38a0c9e351ca3a57d0e417580c8e8b83a12a50?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8bf3c9f6220a13a4d46295ad7c38a0c9e351ca3a57d0e417580c8e8b83a12a50?s=96&d=mm&r=g\",\"caption\":\"Serena\"},\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/author\\\/seema\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Check the Size of PostgreSQL Databases & Tables via SSH","description":"This guide will explain how to check the size of PostgreSQL Databases and Tables through Command line. Follow simple steps.","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.bodhost.com\/kb\/how-to-check-the-size-of-postgresql-databases-tables-via-ssh\/","og_locale":"en_US","og_type":"article","og_title":"Check the Size of PostgreSQL Databases & Tables via SSH","og_description":"This guide will explain how to check the size of PostgreSQL Databases and Tables through Command line. Follow simple steps.","og_url":"https:\/\/www.bodhost.com\/kb\/how-to-check-the-size-of-postgresql-databases-tables-via-ssh\/","og_site_name":"Knowledge Base - bodHOST","article_published_time":"2024-06-10T13:19:26+00:00","article_modified_time":"2026-02-26T14:02:10+00:00","author":"Serena","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Serena","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.bodhost.com\/kb\/how-to-check-the-size-of-postgresql-databases-tables-via-ssh\/#article","isPartOf":{"@id":"https:\/\/www.bodhost.com\/kb\/how-to-check-the-size-of-postgresql-databases-tables-via-ssh\/"},"author":{"name":"Serena","@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/person\/ffd3f118493c99471ae5bd4790a55830"},"headline":"How to Check the Size of PostgreSQL Databases &#038; Tables via SSH","datePublished":"2024-06-10T13:19:26+00:00","dateModified":"2026-02-26T14:02:10+00:00","mainEntityOfPage":{"@id":"https:\/\/www.bodhost.com\/kb\/how-to-check-the-size-of-postgresql-databases-tables-via-ssh\/"},"wordCount":202,"publisher":{"@id":"https:\/\/www.bodhost.com\/kb\/#organization"},"keywords":["PostgreSQL Databases"],"articleSection":["Database"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.bodhost.com\/kb\/how-to-check-the-size-of-postgresql-databases-tables-via-ssh\/","url":"https:\/\/www.bodhost.com\/kb\/how-to-check-the-size-of-postgresql-databases-tables-via-ssh\/","name":"Check the Size of PostgreSQL Databases & Tables via SSH","isPartOf":{"@id":"https:\/\/www.bodhost.com\/kb\/#website"},"datePublished":"2024-06-10T13:19:26+00:00","dateModified":"2026-02-26T14:02:10+00:00","description":"This guide will explain how to check the size of PostgreSQL Databases and Tables through Command line. Follow simple steps.","breadcrumb":{"@id":"https:\/\/www.bodhost.com\/kb\/how-to-check-the-size-of-postgresql-databases-tables-via-ssh\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.bodhost.com\/kb\/how-to-check-the-size-of-postgresql-databases-tables-via-ssh\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.bodhost.com\/kb\/how-to-check-the-size-of-postgresql-databases-tables-via-ssh\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Database","item":"https:\/\/www.bodhost.com\/kb\/category\/database\/"},{"@type":"ListItem","position":2,"name":"How to Check the Size of PostgreSQL Databases &#038; Tables via SSH"}]},{"@type":"WebSite","@id":"https:\/\/www.bodhost.com\/kb\/#website","url":"https:\/\/www.bodhost.com\/kb\/","name":"Web Hosting Knowledge Base | bodHOST Hosting FAQ","description":"","publisher":{"@id":"https:\/\/www.bodhost.com\/kb\/#organization"},"alternateName":"Web Hosting Knowledge Base | bodHOST Hosting FAQ","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.bodhost.com\/kb\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.bodhost.com\/kb\/#organization","name":"Web Hosting Knowledge Base | bodHOST Hosting FAQ","url":"https:\/\/www.bodhost.com\/kb\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/logo\/image\/","url":"https:\/\/www.bodhost.com\/kb\/wp-content\/uploads\/2025\/10\/Profile-Pic.png","contentUrl":"https:\/\/www.bodhost.com\/kb\/wp-content\/uploads\/2025\/10\/Profile-Pic.png","width":240,"height":240,"caption":"Web Hosting Knowledge Base | bodHOST Hosting FAQ"},"image":{"@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/person\/ffd3f118493c99471ae5bd4790a55830","name":"Serena","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/8bf3c9f6220a13a4d46295ad7c38a0c9e351ca3a57d0e417580c8e8b83a12a50?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/8bf3c9f6220a13a4d46295ad7c38a0c9e351ca3a57d0e417580c8e8b83a12a50?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8bf3c9f6220a13a4d46295ad7c38a0c9e351ca3a57d0e417580c8e8b83a12a50?s=96&d=mm&r=g","caption":"Serena"},"url":"https:\/\/www.bodhost.com\/kb\/author\/seema\/"}]}},"_links":{"self":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts\/13239","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/users\/21"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/comments?post=13239"}],"version-history":[{"count":3,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts\/13239\/revisions"}],"predecessor-version":[{"id":13244,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts\/13239\/revisions\/13244"}],"wp:attachment":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/media?parent=13239"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/categories?post=13239"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/tags?post=13239"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}