File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -152,6 +152,7 @@ _319 TILs and counting..._
152152- [ Generate A UUID] ( postgres/generate-a-uuid.md )
153153- [ Generate Series Of Numbers] ( postgres/generate-series-of-numbers.md )
154154- [ Get The Size Of A Database] ( postgres/get-the-size-of-a-database.md )
155+ - [ Get The Size Of A Table] ( postgres/get-the-size-of-a-table.md )
155156- [ Getting A Slice Of An Array] ( postgres/getting-a-slice-of-an-array.md )
156157- [ Insert Just The Defaults] ( postgres/insert-just-the-defaults.md )
157158- [ Integers In Postgres] ( postgres/integers-in-postgres.md )
Original file line number Diff line number Diff line change 1+ # Get The Size Of A Table
2+
3+ In [ Get The Size Of A Database] ( get-the-size-of-a-database.md ) , I showed a
4+ PostgreSQL administrative function, ` pg_database_size() ` , that gets the size
5+ of a given database. With the ` pg_relation_size() ` function, we can get the
6+ size of a given table. For instance, if we'd like to see the size of the
7+ ` reservations ` table, we can executing the following query:
8+
9+ ``` sql
10+ > select pg_relation_size(' reservations' );
11+ pg_relation_size
12+ -- ----------------
13+ 1531904
14+ ```
15+
16+ This gives us the size of the ` reservations ` table in bytes. As you might
17+ expect, the referenced table needs to be part of the connected database and
18+ on the search path.
19+
20+ See [ 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