Search code examples
databasederbyjavadb

When select from a derby view will the query used to create the view be executed again?


I noticed that when I change underlying table , the result of selecting from the view will be different,but I wonder it is because the view update every time table changes or every time being selected from?


Solution

  • is because the view update every time table changes or every time being selected from?

    The latter, i.e. every time you select from the view, the underlying tables will be re-queried, as though you'd run the view's SQL directly.

    Some database systems (but not, I suspect, Derby), have the concept of the "materialized view" which is a snapshot of the view's query results, which may be updated when the data in the underlying tables changes.