Better temporary tables

Temporary tables are often being used. Their performance could be increased if they are removed from system catalog. Also it is attractive to allow using temporary tables on read-only standbys.

Temporary tables outside of system catalog

Some applications create temporary tables at very high rate.  In such cases, writing all of these temporary tables to system catalog becomes an issue, as:

  1. System catalog suffers from bloat;
  2. OIDs are consumed at high rate with risk of wraparound.

The possible solution of this problem is to store temporary table meta-information in memory without touching persistent data structures.

Temporary tables on standbys

Temporary tables on standbys is a very frequently asked feature.  Assuming we can store temporary table meta-information in-memory, we can implement single-transaction temporary tables on standbys.  In order to implement multi-transaction temporary tables we need to solve the MVCC problem.  Currently, standby receives information about xids from master and can’t issue any xid itself.  The solution could be in introduction of parallel axis of “local xids” on standby.