Two models select from the same source table. rpt_orders_view is materialized as view, rpt_orders_table as table. You run dbt run, then new rows land in the source. You query both models in the warehouse. Which statement regarding the results is true?
- Both return the new rows, because dbt refreshes each object when it is queried
- rpt_orders_table returns the new rows, rpt_orders_view does not until the next dbt run
- rpt_orders_view returns the new rows, rpt_orders_table does not until the next dbt runCORRECT
- Neither returns the new rows until the next dbt run
WHY
On each run dbt rebuilds a view model with a create view as statement: the object stores no data, only the select. Every query against rpt_orders_view re-executes that select against the source, so rows that landed after the run are included. A table model is rebuilt with a create table as statement, which writes the result set to storage at run time. rpt_orders_table therefore holds a snapshot frozen at the last dbt run and only picks up the new rows when dbt rebuilds it. That is the core trade-off: the view costs no storage and is always current but pays the transformation cost on every query, while the table costs storage and staleness between runs but is fast to query.
WHY THE OTHERS ARE WRONG
- Both return the new rows, because dbt refreshes each object when it is queried
- dbt does no work at query time — it only runs when you invoke it. The view looks current because the warehouse re-executes its select, not because dbt refreshed anything, and the table is not refreshed at all.
- rpt_orders_table returns the new rows, rpt_orders_view does not until the next dbt run
- This inverts the two materializations. The table is the one holding a stored copy from the last run, so it is the stale object; the view carries no data of its own.
- Neither returns the new rows until the next dbt run
- A view stores no rows, so there is nothing stale to refresh: the warehouse resolves it against the current source data on every query.