Row Id

Each table has a column CTID which holds the row id of a row.

SELECT ctid FROM mytable;

Current Transactions

SELECT datname,usename,procpid,client_addr,waiting,query_start,current_query FROM pg_stat_activity;

Exception Join

The exception join can be created with the combination of the left outer join and the query on null.

Table a:

  • id
  • name

Table b:

  • pid
  • fid
  • longitude
  • latitude

Select every entry from table a which has no entry in table b.

  FROM a LEFT OUTER JOIN b ON ( = b.fid)

Table Scan Options

set enable_seqscan=true;
set enable_indexscan=true;

Command Line Client

Show Tables


Show Columns

\d table_name

Show Databases