You are on page 1of 2

Processing Cyclic Queries

Yahiko Kambayashi

Abstract
The major purpose of this chapter is to summarize existing methods for query
graph modification, to give relationships among them and their applications to
cyclic query processing. For processing a cyclic query, we first transform it into a
tree query using various methods, and then a tree query processing procedure is
applied. The tree query is determined by a spanning tree of the query graph. For
processing tree queries, semi-joins can be used instead of joins. Procedures for
selecting appropriate spanning trees and application to cyclic query processing
procedures for distributed database systems are also discussed.

1. Introduction
Among all relational database operations, the join operation is considered to be the
most time-consuming one. Thus in order to process a query which requires more
than one relation, it is very important to determine how to perform the join
operation. By considering only joins, queries can be divided into two classes: tree
and cyclic. There are efficient procedures to handle tree queries. Properties of tree
queries and procedures for them have been extensively reported [BERNSla)
[BERNSlb) [GOODS2a] [GOODS2c] [YU79). Problems of cyclic processing have
been studied by [GOODS2a) [GOODS2b) and useful procedures for cyclic queries
have been given in [KAMBS2b) [KAMBS3).
It has been shown that any procedure for cyclic-query processing contains a
process to convert the query into a tree query in some sense [GOODS2a) and there
are very good procedures to process tree queries[BERNSla). We will take the the
following approach for processing cyclic queries[KAMBS2b) [KAMBS3).
(a) Convert a given cyclic query into a proper tree query.
(b) Apply the tree query processing procedure to the resulting tree query .
The major purpose of this chapter is to summarize existing methods for cyclic
query processing.
In Section 2, some basic concepts are defined and notations are introduced.
Section 3 shows queries and query graphs. Importance of cyclic query processing is
also discussed. Section 4 summarizes currently known methods of converting to
query graphs, with application to conversion from cyclic queries to tree queries. In
Sections 5 and 6, a few of the more important methods are discussed in detail. In
Section 7 query processing procedures for distributed database systems are given
as applications of these methods.

W. Kim et al. (eds.), Query Processing in Database Systems


© Springer-Verlag Berlin Heidelberg 1985
63

2. Basic Concepts
A relation scheme is a finite set of attributes Ai'S (l<i<n) and it is denoted
by RCAl, A2, ... , ArJ or R Each attribute Ai is associated WIth a value set dom(Ai)
whiCh is called a domain. A relation R on R is a finite set of total mappings,
called tuples, from the set R of attributes to the corresponding domains. A tuple t
can be viewed as an n-tuple (dl, d2, ... , drJ, where di is an element of dom(Ail, by a
proper renaming of attributes. Attribute Ai in Rj is denoted by Rj.Ai. For
simplicity, set union is represented by concatenation; X U Y is denoted by XY.
A projection of a tuple t on attribute set X is denoted by t[X], which is defined
as a part oft corresponding to the attribute set X. The following notations are used
for relational operations.
Projection: R[X] =
{t [X] I t ill}
=
9-selection: OAe'c·R {t I t [A] e 'c', t ill}
9-restriction:oAesR =
{t I t [A] e t [B], t ill}
(Here, e is a comparison operator such as =, <, >, etc., and c is a constant value.
When e is =, these are called selection and restriction, respectively).
9-join: R =
Ri [Ri.Ak e Rj.Ahl Rj =
{tlt2 I tl[Akl e tiAhl , tl c Rb t2 £ Rj }
e-join for more than two relations is expressed by a logical AND of qualification
part, such as [Ril.Akl e Ri.1.Ahl] /\ [Ri2-Ak2 e Rj2-Ah2l .When e is =, it is called an
equi-join. Furthermore. if all attributes in Rj U fu are used as joining attributes,
it is called a natural equi-join. In this case,d.uplication of attributes in Rinfu are
removed and the resulting relation is defined on Ri U fu.
Natural equi-join: R Ri N Rj = =
{t It cR,t mil oRi, t[ful zRj, E Ei U fu} =
Since the join operation is associative, the natural equi-join of m relations RI,
R2, ... , Rm is denoted by RI IX! Rz iXi ... N Rm.
Fig. 1 (a) shows relation Rl(Professor, Age, Course). Here RI is the relation
name. Professor, Age and Course are attribute names, and EI ={professor, Age,
Course}. Meaning of each tuple of RI is that each Professor whose age is Age
teaches a Course. Rl[Professor, Agel and Rl[Professor, Course] are shown in Figs.
1 (b) and (c), respectively. Natural equi-join of the two relations in Figs. l(b) and
(c) is RI.

Rj(Professor, Age, Course) RI[Professor, Age] Rl[Professor, Course]


= R2fProfessor, Coursel
Professor Age Course Professor Age
Professor Course
30 Database a 30
a Database
30 Logie Design b 40
a Logic Design
40 Software
(b)
b Software
(a)
(c)

Fig. 1 - Decomposition of a relation

RiProfessor. Project, Course) RiProfessor, Project)

Professor Project Course Professor Project

·· pI
pI
Database
Logi(' DeSIgn
a


pJ
p2

• p2 Database b p2

• p2 Logic Design b p3
b p2 Software (b)
b p3 Software
Fig. 2 - A multi-valued dependency
(aJ

You might also like