- Neueste
- Die meisten Stimmen
- Die meisten Kommentare
Hi,
I think the doc here is a little misleading:
Each common table expression (CTE) defines a temporary table, which is similar to a view definition. You can reference these temporary tables in the FROM clause.
CTE are an efficient way of defining tables that can be used throughout the execution of a single query. In all cases, the same results can be achieved by using subqueries in the main body of the SELECT statement, but WITH clause subqueries may be simpler to write and read.
Where possible, WITH clause subqueries that are referenced multiple times are optimized as common sub-expressions; that is, it may be possible to evaluate a WITH subquery once and reuse its results.
And the optimization relies on the query optimizer task not the query execution itself.
You can alternatively use materialized views to cache frequently accessed data as described in the following blog:
And since it supports now external tables (https://aws.amazon.com/about-aws/whats-new/2020/06/amazon-redshift-materialized-views-support-external-tables/).
Hope this helps
Relevanter Inhalt
- AWS OFFICIALAktualisiert vor einem Jahr
- AWS OFFICIALAktualisiert vor 6 Monaten
- AWS OFFICIALAktualisiert vor 2 Jahren