Efficient monitoring of database assertions
暂无分享,去创建一个
A principal impediment to the use of declarative assertions for monitoring the state of a dynamic database is the high cost of conventional implementation techniques for such a facility. This paper presents a means of efficiently detecting violations of assertions caused by updates to a database. Our technique is based on the premise that the structure of updates to a database can generally be anticipated, and that an analysis of the potential effect that an update may have on an assertion can enable the assertion to be efficiently tested when the update is performed.This analysis is performed by a compile-time assertion processor; for each type of update operation defined on the database, the assertion processor synthesizes a procedure that will be used to evaluate a set of given assertions whenever an operation of the given type is performed on the database. For each assertion and operation, the assertion processor performs a detailed logical analysis, called perturbation analysis, of the effect that the operation may have on the assertion. Perturbation analysis identifies conditions that can be efficiently tested at run-time (when an operation of the given type is performed) and that minimize the extent to which the assertion must be fully reevaluated; the identified conditions also enable the assertion to be tested before the update is actually performed, thereby avoiding the need for expensive back-out procedures in the case that the assertion is found to be violated. Based on this analysis, the assertion processor generates a set of alternative efficient means of determining whether or not execution of the operation causes the assertion to be violated. A database transaction processor, which estimates the performance cost of each of the alternatives in the context of the physical representation and access methods of the database, can then be used to identify the least expensive means of testing the assertion.This work has been done in the particular context of semantic integrity assertions, but it readily extends to related problems of database monitoring. The efficiency of testing that can be achieved through the use of our assertion processing technique in comparable with that attainable through the use of hand-coded procedures. The technique therefore supports all the advantages of the declarative approach to database assertion-monitoring, while retaining the level of efficiency that is usually associated with procedural methods.