It is all about the ... plus

Posted on Jun 16, 2015

This is just a quick post but imho still pretty neat. If you are a postgresql user you probably know about the commands with \ to inspect your database server e.g. .

mirrorbrain=> \l mirro*
                                  List of databases
    Name     |    Owner    | Encoding |   Collate   |    Ctype    | Access privileges 
-------------+-------------+----------+-------------+-------------+-------------------
 mirrorbrain | mirrorbrain | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
(1 row)

mirrorbrain=> \dt
           List of relations
 Schema |  Name   | Type  |    Owner    
--------+---------+-------+-------------
 public | country | table | mirrorbrain
 public | file    | table | mirrorbrain
 public | hash    | table | mirrorbrain
 public | marker  | table | mirrorbrain
 public | mirror  | table | mirrorbrain
 public | pfx2asn | table | mirrorbrain
 public | region  | table | mirrorbrain
 public | server  | table | mirrorbrain
 public | version | table | mirrorbrain
(9 rows)

mirrorbrain=> 

So far … nothing new … right?

Now how about this?

mirrorbrain=> \l+ mirror*
                                                    List of databases
    Name     |    Owner    | Encoding |   Collate   |    Ctype    | Access privileges | Size  | Tablespace | Description 
-------------+-------------+----------+-------------+-------------+-------------------+-------+------------+-------------
 mirrorbrain | mirrorbrain | UTF8     | en_US.UTF-8 | en_US.UTF-8 |                   | 27 GB | pg_default | 
(1 row)

mirrorbrain=> \dt+
                         List of relations
 Schema |  Name   | Type  |    Owner    |    Size    | Description 
--------+---------+-------+-------------+------------+-------------
 public | country | table | mirrorbrain | 16 kB      | 
 public | file    | table | mirrorbrain | 6765 MB    | 
 public | hash    | table | mirrorbrain | 7749 MB    | 
 public | marker  | table | mirrorbrain | 16 kB      | 
 public | mirror  | table | mirrorbrain | 3893 MB    | 
 public | pfx2asn | table | mirrorbrain | 16 MB      | 
 public | region  | table | mirrorbrain | 8192 bytes | 
 public | server  | table | mirrorbrain | 264 kB     | 
 public | version | table | mirrorbrain | 16 kB      | 
(9 rows)

mirrorbrain=> \di+
                                            List of relations
 Schema |                  Name                   | Type  |    Owner    |  Table  |  Size   | Description 
--------+-----------------------------------------+-------+-------------+---------+---------+-------------
 public | country_pkey                            | index | mirrorbrain | country | 16 kB   | 
 public | filearr_dirname_btree                   | index | mirrorbrain | file    | 2297 MB | 
 public | filearr_path_key                        | index | mirrorbrain | file    | 3731 MB | 
 public | filearr_pkey                            | index | mirrorbrain | file    | 639 MB  | 
 public | hash_pkey                               | index | mirrorbrain | hash    | 403 MB  | 
 public | marker_pkey                             | index | mirrorbrain | marker  | 16 kB   | 
 public | mirror_pkey                             | index | mirrorbrain | mirror  | 2412 MB | 
 public | pfx2asn_pfx_key                         | index | mirrorbrain | pfx2asn | 12 MB   | 
 public | pfx2asn_pkey                            | index | mirrorbrain | pfx2asn | 8376 kB | 
 public | region_pkey                             | index | mirrorbrain | region  | 16 kB   | 
 public | server_enabled_status_baseurl_score_key | index | mirrorbrain | server  | 16 kB   | 
 public | server_identifier_key                   | index | mirrorbrain | server  | 32 kB   | 
 public | server_pkey                             | index | mirrorbrain | server  | 16 kB   | 
 public | version_pkey                            | index | mirrorbrain | version | 16 kB   | 
(14 rows)

mirrorbrain=> 

You could use a more complex solution like this wiki page. But for a quick glance … the plus is enough (imho).