Optional quantifiers in relational and object-oriented views of database systems
First Claim
1. A method, in a database management system, for processing a query, said method comprising:
- receiving said query over a view having a first relation and a second relation, said view having a quantifier designated as optional wherein said quantifier refers to said second relation, said query selecting elements only from said first relation;
processing the query independently of a left outer join operation; and
returning a result set having a number of tuples dependent upon the number of elements in said first relation;
whereby a semantic of the query is equivalent to a left outer join with duplicate elimination if said first relation contains no duplicates.
1 Assignment
0 Petitions
Accused Products
Abstract
A system, method, and program enables database management systems for relational and object-oriented databases to recognize a quantifier in a query as being designated as optional. An optional quantifier will participate in a query depending upon certain conditions. If the columns (or objects) projected out in the view that are dependent upon the quantifier are not used by the query, the quantifier is dropped from the definition of the view. The query is processed using only the relations in the view not associated with the optional quantifier. The results returned are as if a left outer join operation with duplicate elimination had been performed, although the actual processing of the query was independent of, i.e., did not involve, a left outer join operation. If the columns (or objects) projected out in the view that are dependent upon the quantifier are used by the query, the optional quantifier remains in the definition of the view and the query is processed using a join operation.
193 Citations
21 Claims
-
1. A method, in a database management system, for processing a query, said method comprising:
-
receiving said query over a view having a first relation and a second relation, said view having a quantifier designated as optional wherein said quantifier refers to said second relation, said query selecting elements only from said first relation; processing the query independently of a left outer join operation; and returning a result set having a number of tuples dependent upon the number of elements in said first relation; whereby a semantic of the query is equivalent to a left outer join with duplicate elimination if said first relation contains no duplicates. - View Dependent Claims (2)
-
-
3. A method, in a database management system, for processing a query, said method comprising:
-
determining a usage, by said query, of a view having at least a first relation and a second relation by determining whether at least one element is referenced, by said query, from each one of said at least said first relation and said second relation making up the view; determining which one relation of said at least one of said first relation and said second relation is not referenced by the query and determining if there is an optional quantifier associated with said one relation not referenced; removing, from a definition of the view for said query, each of said one relation having said optional quantifier, thereby making a second definition of said view; and processing said query using said second definition of the view.
-
-
4. A method, in a database management system, for processing a query, said method comprising:
-
determining a usage, by said query, of a view having at least a first relation and a second relation; determining if there is an optional quantifier associated with elements from any of said first relation and said second relation; and removing, from a definition of the view for said query, said optional quantifier if elements, belonging to the optional quantifier, that are projected out from the view are unused by the query, thereby making a second definition of the view; and processing said query using said second definition of the view.
-
-
5. A method, for use in a database management system, for processing a query, said method comprising:
-
parsing said query; generating an internal representation of said query including a) each view that the query is referencing and any additional view said view is using, b) each quantifier, and c) an indication if said each quantifier has been designated as optional; determining whether or not to keep any one of said each quantifier designated as optional; determining whether said quantifier designated as optional will affect a semantic of the query; rewriting said query dependent upon said determinations; and processing said query based upon said query as rewritten. - View Dependent Claims (6, 7, 8, 9)
-
-
10. A database system comprising:
-
means for providing a capability for a user to query, via a query, at least one subpart of a view; means for providing a capability for said user to designate another part of the view as optional; means enabling a behavior of a view to be dependent upon an element selected from the view by the query; and means for changing a semantic of the view depending upon a different use of the view by the query.
-
-
11. A database system comprising:
-
means for providing a capability for a user to query, via a query, at least one subpart of a view; means, in response to the query involving only said subpart of the view, for eliminating a remaining part of the view from an optimized query if said remaining part of the view is not involved in accessing certain ones of at least one attribute from the query and said remaining part had been designated as optional.
-
-
12. A database system comprising:
-
means for recognizing a quantifier designated, in a view, as optional in a query to said database system; and means for eliminating the quantifier from participation in the view if each one of at least one element, dependent upon the quantifier and projected out in the view used by the view, are unused by the query.
-
-
13. The database system of 12 wherein said means for eliminating the quantifier from participation in said query comprises dropping the quantifier from the definition of the view.
-
14. A database system comprising:
-
means for providing a single view type of a plurality of relations; means for providing a capability for at least one quantifier associated with at least one of said plurality of relations to be designated as optional; means for allowing at least one of a plurality of columns to be selected in a query; and providing a capability to change a semantic of the query depending upon which columns are selected and which quantifier is designated as optional.
-
-
15. A database system comprising:
-
means for recognizing a quantifier, appearing in a view definition, annotated as being optional; means for dropping the quantifier marked as optional, by a query rewrite engine, if each of at least one projected column, dependent upon the quantifier, of the view is unused by a query; means for reusing the view for a second query; and means for changing a semantic of the second query depending upon a usage of the view.
-
-
16. A computer system having a database management system, at least one random access storage device for storing relations of information, a communication link for receiving and sending data to at least one remote client computer system having access to said relations of information, said computer system comprising:
-
means for parsing a query received from a user; means for generating an internal representation of said query including a) each one of at least one view that the query is referencing and any additional at least one view said each one of at least one view is using, b) each one of at least one quantifier, and c) an indication if said each one of at least one quantifier has been designated as optional; and means for determining whether or not to keep any one of said at least one quantifier designated as optional; means for determining whether said quantifier designated as optional will affect a semantic of the query; means for rewriting said query dependent upon said determinations; means for optimizing a rewritten query independently of an optional designation of any of said at least one quantifier; and means for processing said query based upon said rewritten query optimized.
-
-
17. An article of manufacture comprising:
-
a computer usable medium having computer readable program code means embodied therein for processing a query, the computer readable program code means in said article of manufacture comprising; computer readable program code means for providing a database management system a capability to receive said query over a view having a first relation and a second relation, said view having a quantifier designated as optional wherein said quantifier refers to said second relation, said query selecting elements only from said first relation; computer readable program code means for providing a capability to process the query independently of a left outer join operation; and computer readable program code means for providing a capability to return a result set having a number of tuples dependent upon the number of elements in said first relation; whereby a semantic of the query is equivalent to a left outer join with duplicate elimination if said first relation contains no duplicates. - View Dependent Claims (18)
-
-
19. An article of manufacture comprising:
-
a computer usable medium having computer readable program code means embodied therein, the computer readable program code means in said article of manufacture comprising; computer readable program code means for providing a database management system a capability to determine a usage, by said query, of a view having at least a first relation and a second relation by determining whether at least one element is referenced, by said query, from each one of said at least said first relation and said second relation making up the view; computer readable program code means for providing a capability to determine which one relation of said at least one of said first relation and said second relation is not referenced by the query and determining if there is an optional quantifier associated with said one relation not referenced; and computer readable program code means for providing a capability to remove, from a definition of the view for said query, each of said one relation having said optional quantifier, thereby making a second definition of said view.
-
-
20. An article of manufacture comprising:
-
a computer usable medium having computer readable program code means embodied therein for processing a query, the computer readable program code means in said article of manufacture comprising; computer readable program code means for providing a database management system a capability to determine a usage, by said query, of a view having at least a first relation and a second relation; computer readable program code means for providing a capability to determine if there is an optional quantifier associated with elements from any of said at least said first relation and said second relation; computer readable program code means for providing a capability to remove, from a definition of the view for said query, said optional quantifier if elements, belonging to the optional quantifier, that are projected out from the view are unused by the query, thereby making a second definition of the view; and computer readable program code means for providing a capability to process said query using said second definition of the view.
-
-
21. An article of manufacture comprising:
-
a computer usable medium having computer readable program code means embodied therein for processing a query, the computer readable program code means in said article of manufacture comprising; computer readable program code means for providing a database management system a capability to recognize a quantifier designated, in a view, as optional in a query to a database system; and computer readable program code means for providing a capability to eliminate the quantifier from participation in said query if each one of at least one element, dependent upon the quantifier and projected out in the view used by said query, are unused by the query.
-
Specification