Products
Time series and analytics
PostgreSQL but faster. Built for lightning-fast ingest and querying of time-based and event data.
Time series and analyticsAI and Vector
PostgreSQL for AI. Seamlessly build RAG, search, and AI agents with the pgvector, pgvectorscale, and pgai extensions.
AI and VectorDeployment options & services
Support Services
Support options to adapt to your use case, infrastructure, and budget.
Open-Source Extensions and Tools
Open-source PostgreSQL extensions you can run on your own instances.
Security scanner
pgspot
We’re in your corner even during the trial phase. Contact us to discuss your use case with a Timescale technical expert.
Timescale is PostgreSQL made Powerful
Industries that rely on us
Featured articles
PostgreSQL for Industrial IoT Data
How OpenSauced Is Building a Copilot for Git History With pgvector and Timescale
AI and Vector
PostgreSQL for AI. Seamlessly build RAG, search, and AI agents with the pgvector, pgvectorscale, and pgai extensions.
pgai docspgvector docsAI and VectorLearn PostgreSQL
Timescale is PostgreSQL, but faster. Learn the PostgreSQL basics and scale your database performance to new heights
Subscribe to the Timescale Newsletter
By submitting, you acknowledge Timescale’s Privacy Policy
By submitting, you acknowledge Timescale’s Privacy Policy
A temporary view in PostgreSQL is a database object that's only available for the duration of a session. It's similar to a regular view, but it disappears once the session ends. Temporary views can be useful when you need to work with a subset of data multiple times within a single session.
However, once your session ends or you disconnect from the database, PostgreSQL will automatically drop the temporary view.
Here's how you create a temporary view:
CREATE TEMPORARY VIEW temp_view AS
SELECT column1, column2
FROM table_name
WHERE condition;
A PostgreSQL temporary view is more of a convenience, really. It may help the query writer “clear its head” a little, and it also simplifies the query into multiple parts, much like a common table expression (CTE).
There is one additional vantage, albeit very very small: creating a temporary view is not (write-ahead log) WAL-logged, which may seem pretty trivial, but it adds up. While creating a regular view is WAL-logged (just creating it, not selecting the data), a CTE is not—unless it modifies the data. Want to learn more about PostgreSQL basics? Check out our guide to Understanding PostgreSQL Functions.