On the other hand, in the recursive algebra, this prob-
lem does not often arise since nest and unnest are not
used very often in queries, as they are not needed for
accessing subrelations but are used only when the data
is restructured. Now, let us consider the equivalent ex-
pressions in the recursive algebra for the ones in the
above example.
(i) w (x((A’, B, C(D), F)(w (rl, W(O 4
(ii) n((A’, B, C(D), F)(w (w (rl(A’), r3), 4))
The second expression can be easily derived from the
first by applying laws, 9 and 7d.
So, since queries in the non-recursive algebra are
typically long and complicated with a number of nests
and unnests, they are not easily optimized. The same
queries can be optimized more efficiently in the recur-
sive algebra, since nest and unnest are used only when
restructuring is really necessary.
4.
Conclusions
The nested relational model is more suitable for repre-
senting complex objects than the traditional relational
model. However, most query languages that have been
proposed for this model require either restructuring op-
erators or special navigational operators for accessing
tuples that are nested at different levels in a nested re-
lation. In this paper, we have described a recursive al-
gebra for nested relations which allows queries to be ex-
pressed succinctly without any restructuring or special
navigational operators. The nested relational model,
is a recursive extension of the relational model; it is
hence only natural that query languages for this model
be extended similarly. We have also developed query
optimization principles for this algebra and shown that
most of them can be viewed as extensions of the opti-
mization principles for the relational algebra. Finally,
we have pointed out the problems in optimizing queries
written in query languages which require restructuring
operations in order to access subrelations. In conclu-
sion, we claim that the recursive algebra is better suited
for the nested relational model than other query lan-
guages that have been proposed for this model.
Acknowledgements
I would like to thank Marc Gyssens, Dirk Van Gucht
and the refrees for their helpful suggestions and com-
ments.
References
1. Abiteboul, S., and Bidoit, N., “Non First Normal
Form Relations to Represent Hierarchically Orga-
nized Data,,,
Proc. 3rd PODS,
1984, pp. 191-200.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
Bancilhon, F., Richard, P., and Scholl, M., “On
Line Processing of Compacted Relations,”
Proc.
8th VLDB,
Mexico City, 1982, pp. 21-37.
Bidoit, N., “The Verso Algebra or How to Answer
Queries with Fewer Joins,”
Journal
of
Computer
and System
Sciences, 1987, pp. 321-364
Codd, E.F., “A Relational Model for Large Shared
Data Banks, ”
Communications ACM
Vol. 6, No.
13, June 1970, pp. 377-387.
Colby, L.S., “A Recursive Algebra for Nested Re-
lations,,, Technical
Report,
No. 259, August 1988,
University of Indiana
Dadam, P., Kuespert, F., Andersen, F., Blanken,
H., Erbe, R., Guenauer, J., Lum, V., Pistor, P.,
and Walch,G., “A DBMS Prototype to Support Ex-
tended NF2 Relations: An Integrated View on Flat
Tables and Hierarchies,”
Proc. Annual SIGMOD
Conf., Austin, 1986, pp. 356-366.
Deppisch, U., Paul, H.B., and Schek, H.J., “A Stor-
age System for Complex Objects,”
Proc. Int. Worh-
shop on Object- Oriented Database Systems,
Pacific
Grove, 1986, pp. 183-195.
Deshpande, V., and Larson, P.A., “An Algebra for
Nested Relations,”
Tech. Report, CS-87-6.5,
1987,
University of Waterloo.
Deshpande, A., and Van Gucht, D., “A Storage
Structure for Unnormalized Relations,”
Proc. GI
Conf. on Database Systems
for
Ofice Automation,
Engineering and Scientific Applications,
Darmstadt,
April 1987, pp. 481-486.
Gyssens, M. and Van Gucht, D., “The Powerset
Algebra as a Result of Adding Programming Con-
structs to the Nested Relational Algebra,”
Proc.
Annual SIGMOD Conf.,
Chicago, IL, June 1988
Jaeshke, G., and Schek, H.J., “Remarks on the Al-
gebra on Non-First Normal Form Relations,”
Proc.
1st PODS,
Los Angeles, 1982, pp. 124-138.
Linnemann, V., “Non First Normal Form Relations
and Recursive Queries: An SQL-Based Approach,”
Proc. 3rd IEEE Int. Conf. on Data
Engineering,
Los Angeles, 1987.
Makinouchi, A., “A Consideration of Normal Form
of Not- Necessarily-Normalized Relations in the Re-
lational Data Model,”
Proc. 3rd. VLDB,
Tokyo
1977, pp. 447-453.
Ozsoyoglu, G., Ozsoyoglu, Z.M., and Matos, V.,
“Extending Relational Algebra and Relational Cal-
culus with Set-Valued Attributes and Aggregate
Functions,”
ACM Transactions on Database Sys-
tems,
Vol. 12, No. 4, December 1987, pp. 566-592.
Paul, H.B., Schek, H.J., Scholl, M.H., Weikum,
G., and Deppisch, U.,
“Architecture and Imple-
mentation of the Darmstadt Database Kernel Sys-
282