Today I Learned

hashrocket A Hashrocket project

Temporary Tables

Create a temporary table in Postgres like so

create temp table posts (
    ...
);

This table (and its data) will only last for the duration of the session. It is created on a schema specific to temporary tables. It is also worth noting that it won't be autovacuumed, so this must be done manually as necessary.

See More #sql TILs
Looking for help? Hashrocket developers believe that data quality is as important as code quality. We enjoy all the challenges of relational databases, from finding the fastest index, to structuring data to fit the needs of an application. We're eager to share our experiences; check out PG Casts, our series of free PostgreSQL screencasts.