mirror of
https://github.com/jbranchaud/til
synced 2026-01-06 08:38:01 +00:00
Add Get The Size of A Database as a postgres til
This commit is contained in:
16
postgres/get-the-size-of-a-database.md
Normal file
16
postgres/get-the-size-of-a-database.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# Get The Size Of A Database
|
||||
|
||||
If you have connect access to a database, you can use the
|
||||
`pg_database_size()` function to get the size of a database in bytes.
|
||||
|
||||
```sql
|
||||
> select pg_database_size('hr_hotels');
|
||||
pg_database_size
|
||||
------------------
|
||||
8249516
|
||||
```
|
||||
|
||||
Just give it the name of the database and it will tell you how much disk
|
||||
space that database is taking up.
|
||||
|
||||
Checkout [the Postgres docs](http://www.postgresql.org/docs/current/static/functions-admin.html) for more details.
|
||||
Reference in New Issue
Block a user