File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,7 @@ _319 TILs and counting..._
151151- [ Fizzbuzz With Common Table Expressions] ( postgres/fizzbuzz-with-common-table-expressions.md )
152152- [ Generate A UUID] ( postgres/generate-a-uuid.md )
153153- [ Generate Series Of Numbers] ( postgres/generate-series-of-numbers.md )
154+ - [ Get The Size Of A Database] ( postgres/get-the-size-of-a-database.md )
154155- [ Getting A Slice Of An Array] ( postgres/getting-a-slice-of-an-array.md )
155156- [ Insert Just The Defaults] ( postgres/insert-just-the-defaults.md )
156157- [ Integers In Postgres] ( postgres/integers-in-postgres.md )
Original file line number Diff line number Diff line change 1+ # Get The Size Of A Database
2+
3+ If you have connect access to a database, you can use the
4+ ` pg_database_size() ` function to get the size of a database in bytes.
5+
6+ ``` sql
7+ > select pg_database_size(' hr_hotels' );
8+ pg_database_size
9+ -- ----------------
10+ 8249516
11+ ```
12+
13+ Just give it the name of the database and it will tell you how much disk
14+ space that database is taking up.
15+
16+ Checkout [ the Postgres docs] ( http://www.postgresql.org/docs/current/static/functions-admin.html ) for more details.
You can’t perform that action at this time.
0 commit comments