OEM views meeting 1/22/97 Attendees: Serge, Jason, Roy, Vasilis, Yue. Vasilis prepared a writeup and we started our discussion there. Our objective is that given definition of view V, rewrite a query Q on V to be query Q' on the base database DB, such that Q'( DB ) = Q( V( DB )) for all possible DB. In other words, in Q, objects and paths refer to those in V (an ordinary oem database.) We need to replace those objects and paths by those in DB. (Step 1) After correctly done the above replacement, we may optimize the resulting query for evaluation. (Step 2) We discuss each step in a little more detail below: ------------- Step 0: before query rewriting (or as part of the query rewriting), it is possible to do a quick check to screen out queries that will return empty answer --- by looking at the paths in the query and in the view definition. ------------- Step 1: We have view definition V with the format select XX from XX where XX with XX And we have query Q with format: select XX from XX where XX We would like to have the resulting query Q' to be a LOREL sfw query, probably with nesting(?). We tried to replace objects in the from clause in the query by view definition query, and we come up with examples that this replacement does not always give correct results. A counter-example is: V: select Z, X from Boss Z, Z.emp X, Z.emp Y where X.sal > 10, Y.sal < 10 with Z.emp, X.name Q: (q)select X.name (q)from V.* X We can not replace V.* in Q by all the nodes that can be obtained from the view query, and evaluate the resulting query using the original DB. Because the emp nodes with salary < 10 is in the view (as a result of With Z.emp). However, their name should not be displayed since their name should not be in the view. The conclusion is, we may need to evaluate the view condition again after they have been evaluated once when computing the (q)from clause. ------------- Step 2. Optimization: the most straightforward optimizations we can think of is common sub-expression evaluation. ------------- One last thing serge suggested was that we may use an approach between fully virtual and fully materialized to evaluate a view. That is, to evaluate Q( V(DB)), it's possible to rewrite it into Q'(V'(DB)) such that some selection condition in Q is pushed into view, and presumably V' is a smaller database than V and Q' is a simpler query than Q. ---------------