Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't create temp tables at plan time unless they're actually needed #2496

Open
georgesittas opened this issue Apr 23, 2024 · 0 comments
Open
Labels
Improvement Improves existing functionality

Comments

@georgesittas
Copy link
Contributor

georgesittas commented Apr 23, 2024

We currently create temporary tables at plan time preemptively, even though they may not necessarily be needed. This behavior was introduced before we started to create tables on demand (i.e., if they're missing), but we can move away from it now.

For instance, the initial plan application for the example project produces the following tables in duckdb:

CREATE TABLE sqlmesh__sqlmesh_example.sqlmesh_example__full_model__3031530868(item_id INTEGER, num_orders BIGINT);
CREATE TABLE sqlmesh__sqlmesh_example.sqlmesh_example__full_model__3031530868__temp(item_id INTEGER, num_orders BIGINT);
CREATE TABLE sqlmesh__sqlmesh_example.sqlmesh_example__incremental_model__141311533(id INTEGER, item_id INTEGER, event_date DATE);
CREATE TABLE sqlmesh__sqlmesh_example.sqlmesh_example__incremental_model__141311533__temp(id INTEGER, item_id INTEGER, event_date DATE);
CREATE TABLE sqlmesh__sqlmesh_example.sqlmesh_example__seed_model__1248844913(id INTEGER, item_id INTEGER, event_date DATE);
CREATE TABLE sqlmesh__sqlmesh_example.sqlmesh_example__seed_model__1248844913__temp(id INTEGER, item_id INTEGER, event_date DATE);
@georgesittas georgesittas added the Improvement Improves existing functionality label Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Improvement Improves existing functionality
Projects
None yet
Development

No branches or pull requests

1 participant