Book contents
- Frontmatter
- Contents
- Acknowledgments
- 1 Introduction
- 2 Classes of update semantics
- 3 Model-based semantics for updates
- 4 Update algorithms for model-based semantics
- 5 Updates with variables
- 6 Lazy evaluation of updates
- 7 Integrity constraints
- 8 Adding knowledge to relational theories
- 9 Implementation
- Bibliography
- Index of definitions
5 - Updates with variables
Published online by Cambridge University Press: 22 March 2010
- Frontmatter
- Contents
- Acknowledgments
- 1 Introduction
- 2 Classes of update semantics
- 3 Model-based semantics for updates
- 4 Update algorithms for model-based semantics
- 5 Updates with variables
- 6 Lazy evaluation of updates
- 7 Integrity constraints
- 8 Adding knowledge to relational theories
- 9 Implementation
- Bibliography
- Index of definitions
Summary
In traditional data manipulation languages, variables can occur in updates. Typically, these updates only cause changes in a single tuple; the variables are used as placeholders for don't-care values in that tuple. For example, in updating an employee's salary, variables can be used for all the irrelevant attributes of the employee record, and only the employee ID and the new salary specified in the update request.
To speed query processing in a relational theory, it may be desirable to restrict the body of the theory to ground formulas, as we did in the preceding chapters. In this case, to perform an update U containing variables, one must first find all the bindings σ of variables to data values such that the selection clause (φ)σ of U might be satisfied by some model of the theory. (In general, we expect all variables in ω to also appear in φ.) Each such set of bindings transforms U into a ground update (U)σ. The task of the update algorithm is then to perform all the ground updates (U)σ simultaneously, as described in Section 5.1. The cost of an update containing variables will be a function of the number of bindings σ for its variables, just as in ordinary relational databases.
If, on the other hand, the body of the relational theory is not restricted to ground formulas, updates with variables are very easy to perform, as shown in Section 5.2.
As usual, we confine our attention to insert requests: insert ω where φ.
- Type
- Chapter
- Information
- Updating Logical Databases , pp. 84 - 96Publisher: Cambridge University PressPrint publication year: 1990