Table Oriented Metrics For Relational Database
Table Oriented Metrics For Relational Database
Abstract. Developing and selecting high quality software applications are fundamental. It is important
that the software applications can be evaluated for every relevant quality characteristic using validated
metrics. Software engineers have been putting forward hundreds of quality metrics for software programs,
disregarding databases. However, software data aspects are important because the size of data and
their system nature contribute to many aspects of a systems quality. In this paper, we proposed some
internal metrics to measure relational databases which influence its complexity. Considering the main
characteristics of a relational table, we can propose the number of attributes (NA) of a table, the depth
of the referential tree (DRT) of a table, and the referential degree (RD) of a table. These measures are
characterized using measurement theory, particularly the formal framework proposed by Zuse. As many
important issues faced by the software engineering community can only be addressed by experimentation,
an experiment has been carried out in order to validate these metrics.
1. Introduction
usability, efficiency, maintainability and portability. Taking into account that main-
tenance accounts for between 60 and 90% of life cycle costs (Card and Glass, 1990;
Pigoski, 1997), we have focused our work on maintainability. ISO/IEC 9126 distin-
guishes five subcharacteristics for maintainability: analyzability, changeability, sta-
bility, testability and compliance (see Figure 1). Analyzability, changeability and
testability are in turn influenced by complexity (Li and Chen, 1987). However, a
general complexity measure is “the impossible holy grail” (Fenton, 1994). Henderson-
Sellers (1996) distinguishes three types of complexity: computational, psychological
and representational, and for psychological complexity he considers three compo-
nents: problem complexity, human cognitive factors and product complexity
(Henderson-Selleres, 1996). The last one is our focus.
Therefore, the metrics we define are for measuring the complexity, the internal
attribute, of relational databases to assess relational database maintainability, the
external attribute.
Software quality
complexity
Design product metrics can be sub-divided into intra- and inter-module met-
rics. Likewise, table complexity can be characterized as intra-table complexity where
the table in isolation is measured, and inter-table complexity where the implicit
interaction among tables is measured. Following this distinction, we can define two
different kinds of metrics in relational databases: table-oriented (intra-table com-
plexity metrics) and schema-oriented (inter-table complexity metrics), depending on
the level on which we are measuring. Schema-oriented metrics are proposed and
analyzed in (Calero et al., 2000). In this paper, we propose and validate three table-
oriented metrics: number of attributes (NA) of a table, depth of referential tree
(DRT) of a table, and referential degree (RD) of a table. These measures are char-
acterized using measurement theory, particularly the formal framework proposed
by Zuse (1998).
Section 2 presents the method used for correct metrics definition, the different
measures proposed are presented in Section 3. We give a brief introduction to the
Zuse’s framework in Section 4, using it to characterize the metrics in Section 5.
Section 6 presents the experiment performed with the referential integrity related
metrics. The conclusions and future work are presented in the last section.
• Metrics definition. The first step is the proposal of metrics. Although this step
could look simple, it is necessary to take care on defining the metrics. This defini-
tion must be made taking into account the specific characteristics of the database
we want to measure and the experience of database designers and administrators
METRIC DEFINITION
EMPIRICAL VALIDATION
THEORETICAL
VALIDATION EXPERI CASE
MENTS STUDIES
As we can see in Figure 2, the process of defining and validating database metrics is
evolutionary and iterative. As a result of the feedback metrics could be redefined of
discarded depending on the theoretical or the empirical or psychological validations.
The relational model proposed by Codd in the late sixties (Codd, 1970), currently
dominates the database market. In spite of their diffusion, the only indicator, which
has been used to measure the quality of relational database, has been the normal-
ization theory, upon which (Gray et al., 1991) proposed to obtain a normalization
ratio.
Normalization alone is not enough to characterize database quality. It is necessary
to dispose on metrics specifics for this kind of databases. To obtain them, we can
use the GQM approach (Basili and Weiss, 1984), which is based on the fact that any
metric can be defined by a top–down schema. The GQM is a three levels model: the
conceptual level, where the goals are defined (goal), the operational level, where
the questions are defined (question) and the quantitative level, where the metrics
are defined (metric).
The application of the GQM approach to relational databases is shown as follows:
Goal. Our goal is to improve the maintainability of the relational databases from
the designer point of view.
Question. How the table complexity influences the relational databases
maintainability?
Metric. And for answering this question, we proposed the following metrics:
Depth of the referential tree. The DRT of a table A (DRT(A)), is the length of
the longest referential path from the table A, counted as the number of arcs on
the path. The cycles are only considered once.
set cannot itself be shown to be fit for a purpose, it cannot be used to validate met-
rics. We cannot tell whether a measure that does not satisfy the axioms has failed,
because either it is not a measure of the class defined by the set of axioms (e.g.,
complexity, length ) or because the axiom set is inappropriate. Since the goal of
axiomatization in software metrics research is primarily definitional, with the aim of
providing a standard against which to validate software metrics, it is not so obvious
that the risks outweight the benefits (Kitchenham and Stell, 1997).
The strength of measurement theory is the formulation of empirical conditions
from which we can derive hypothesis of reality. In this paper, we will follow the
formal framework of Zuse (1998) in order to describe the properties of the metrics
defined above. This framework is based on an extension of classical measurement
theory, which gives a sound basis for software measures, their validation and the
criteria for measurement scales (see the Appendix). As a result of applying this
framework we can know to which scale a metric pertains and, behind the scales
are hidden the empirical properties of software measures. If we know the scale to
which a metric pertains, we have some mathematical information as the operations
we can make with that metric or what kind of statistics it is possible to apply to that
metric.
In the following section, we adapt this framework to relational databases to verify
the fulfilment of the axioms for the metrics proposed in Section 3.
In relational database systems, and for our purposes, the empirical relational system
could be defined as
T = T • >=
where T is a non-empty set of relations (tables), • >= is the empirical relation
“more or equal complex than” on T, while is a closed binary (concatenation)
operation on T. In our case we will choose “natural join” as the concatenation
operation. Natural join is defined generally as (Elmasri and Navathe (1999)):
Q → Tlist1∗ list2 S
where list1 specifies a list of i attributes of T and list2 is a list of i attributes of
S. These lists are used in order to make the comparison equality conditions between
pairs of attributes. These conditions are afterwards related with the AND operator.
Only the list corresponding to the T relation is preserved in Q.
All these characteristics of the natural join will be useful to design the combination
rule of the metrics.
The DRT measure is a mapping: DRT: T → such that the following holds for all
tables Ti and Tj ∈ T
Ti • >= Tj ⇔ DRTTi >= DRT Tj
TABLE ORIENTED METRICS FOR RELATIONAL DATABASES 85
In order to obtain the combination rule for DRT we may think of several pos-
sibilities: the natural join may derive in a Cartesian product, or may be created
between columns not related by referential integrity (in both cases the referential
paths are not affected by the combination and the final value of the metric is the
longest referential path), or the natural join may be made by foreign key–primary
key link (the length of the referential paths may vary, decreasing in one).
So, we can generalise and define the combination rule as
being v a variable.
and also
C B T1
T2 T
DRT(T1)=2 DRT(T1oT)=2
DRT(T2)=0 DRT(T2oT)=3
5.1.2. DRT and the independence conditions. From Figure 4, we can see that the
first axiom may not be fulfilled. If DRT does not fulfill C1 or C2. Axioms three and
four are not fulfilled because the monotonicity axiom is not fulfilled.
5.1.3. DRT and the modified structure of belief. Now, we must prove if DRT verifies
the modified structure of belief. If the metric meets the weak order, then the first
and the second axioms of the modified structure of belief are fulfilled. The third
axiom is also fulfilled because if all referential paths of B are included in A, then
the value of the longest path of A will be greater than or equal to the value for B.
The weak monotonicity axiom is also accomplished because the same referential
paths of C are added to A and B. Furthermore, if DRT(A) is greater than DRT(B)
it will also be greater after the concatenation of the C paths. The last condition,
positivity, is also fulfilled because the length cannot be less than zero. In summary,
we can characterize DRT as a measure above the level of the ordinal scale, assuming
the modified relation of belief.
The RD measure is a mapping: RD
T → such that the following holds for all
relations Ti and Tj ∈ T
Ti • >= Tj ⇔ RDTi >= RDTj .
In order to obtain the combination rule for RD, we must be sure that if the
concatenation (by natural join) between tables is made by foreign key, the number
of foreign keys are affected (decreasing in one), and are not affected in other cases.
So, we can characterize the combination rule for RD as
B R1
C R2 R
DRT(R1)=1 DRT(R1oR)=1
DRT(R2)=1 DRT(R2oR)=2
The NA measure is a mapping: NA
T → such that the following holds for all
relations Ti and Tj ∈ T
Ti • >= Tj ⇔ NATi >= NATj .
In Figure 5, we can see some of the characteristics that would accomplish the
number of attributes when the two tables are combined (by natural join). So, the
combination rule for NA can be defined as
where NA(Ti ∩ Tj ) is the number of attributes which are common to (belong to the
intersection of) Ti and Tj .
Making the formal verification, NA can be characterized as a measure above the
level of the ordinal scale, assuming the modified relation of belief. Table 2 presents
the results obtained for the three metrics discussed.
A B C NA(T1) = 3 A D B C E F
D E F NA(T1 o T2) = 6
NA(T2) = 3
A B C NA(T1) = 3 A D B C E
A B C NA(T1) = 3 A B C E F
6. Empirical validation
Empirical research can help to characterize the practical utilization of the metrics.
The observation of software metrics is necessary in an experimental sense (Brilliant
and Knight, 1999) in order to validate them from a practical point of view.
In this section, we resume an experiment carried out in order to validate DRT and
RD metrics. This empirical validation has been carried out following the experimen-
tal method applied to software engineering (Pfleeger, 1995; Bourque and
Côte, 1991). We have begun with these two metrics because both are related with
referential integrity. Other experiments to empirically validate the NA metric are
also being developed.
Our purpose is to prove that metrics DRT and RD can be used for measuring
the complexity of a relational database schema. In the experiment we work with the
DRT and the RD metrics to determine whether or not some of them are relevant
for measuring the complexity of a relational database schema.
6.1. Hypotheses
• Null hypothesis. Different values of metrics do not affect the analyzability of the
database schema.
• Alternative hypothesis 1. The value of the DRT metric affects the analyzability of
the database schema.
• Alternative hypothesis 2. The value of the RD metric affects the analyzability of
the database schema.
TABLE ORIENTED METRICS FOR RELATIONAL DATABASES 89
• Alternative hypothesis 3. The combination of the DRT and RD metrics affects the
analyzability of the database schema.
6.2. Subjects
The participants in the experiment are Computer Science students at the University
of Castilla-La Mancha (Spain), who were enrolled for the last two semesters in a
database course. Until the day of the experiment, the students did not know that
they were going to do it. The experiment was developed by 60 students but only 59
were finally accepted.
The documentation accompanying each design was approximately seven pages long
and included the schema database, the tables with their rows and the question/
answer paper. For each design the database schema had six tables (all the experi-
mental materials can be found in http://alarcos.inf-cr.uclm.es).
The subjects were asked to perform three tasks with the values of the database
schema: insert, delete and update. Figure 6 shows the question/answer paper. A
handout was given to each student, and they had 10 minutes to complete each test.
A preliminary experiment was led with a different and smaller set of students to
improve the final version.
The experiment attempts to prove whether the DRT and the RD metrics increased
the difficulty of understanding the relational schema. We have a factorial model, as
all the values a factor can take are combined with all values of the other factor. As
we have a constant number of observations in each experimental cell (number of
students who answered correctly), the model is balanced. A crossing design as the
one described above produces the matrix shown in Table 3 where each value of the
matrix is a pair (DRT, RD).
Independent variables. The independent variables are DRT and RD. Each one of
these independent variables has two levels, eight or five for RD metric and two or
five for DRT metric.
Dependent variables. In our experiments, the variable depends on the number of
questions correctly answered in each test. Since what we wanted to measure is
understandability, we decided to give our subjects ten minutes per test. This way,
all the tests, not necessarily completed, would be taken as valid, and thus our study
would focus on the different amounts of correct answers obtained for each test of
the experiment.
Controlled variables. We have tried to minimize variability among participants
choosing students from the same degree and with the same experience in databases.
Effects of irrelevant variables were minimized by making the same trials for all the
subjects in the same time (10 minutes).
Procedure. Experiments were made consecutively during an hour session. Before
we started, the experiment was explained, what kind of exercises may be developed,
the material given, how to respond to the questions, and how much time they had
to take each test.
The complete documentation was given to each subject, the documentation con-
tained all the materials related to the four tests: relational schema, tables with data
and the question/answer paper. When the time of each test ended, the subjects were
informed and, immediately, they could change to another test. The tests were made
in different order by the subjects to prevent apprenticeship effects. When the tests
Factor B (RD)
LOW HIGH
Factor A
(TDRT) LOW 2,5 2,8
were marked, the right answers above the total answers were selected for obtaining
the results of the experiment.
There are three major items to consider when choosing the analysis techniques:
the nature of the data collected, why the experiment is performed and the type of
experimental design used (Pfleeger, 1995).
As we have already indicated, we have a factorial model, where we intend to prove
whether there is interaction between the two factors. Due to these characteristics,
the F statistic is the most appropriate technique to obtain the results (Rohatgi,
1976).
Table 4 shows the results for the F -statistic. In this table, the first column rep-
resents the dependent variables, column two the variability (among rows, among
columns, of the interaction and for each experimental plot, which is not due nei-
ther to the factors we are analysing here nor to their interaction). The third column
represents the degrees of freedom and the last one indicates the results obtained
for our experiment, these values must be compared to the table values. In each row
of the table we have the two factors of the experiment, the interaction, the error
and the total.
Power of a statistical test is dependent on three different components: (error
margin), the size of the effect being investigated and the number of subjects. Since
the effect size and the number of subjects are constants, increasing is the only
option for increasing the power of the test applied. This way, instead of choosing a
value = 005 (95% level of confidence) which is more normal, we choose a value
= 01 (90% level of confidence).
This way, with = 01, we look for the statistic value in tables where the numera-
tor is 1 (in the three cases, DRT, RD and interaction, we have a degree of freedom)
and the denominator is 232 (degree of freedom of the error), seeing that the value
is F1 232 = 273. Comparing the values obtained from the experiment with F1 232 , we
can ensure
• Alternative hypothesis 1. “The value of the DRT metric affects the analyzability of
database schema.” Since 167 < 273, DRT does not affect the results of the exper-
iment. Therefore, alternative hypothesis 1 is invalid because the value of the DRT
metric does not affect the results obtained.
92 PIATTINI, CALERO AND GENERO
We can, therefore, conclude that the number of foreign keys in a relational database
schema is a solid indicator of its complexity and that the length of the referential
tree is not relevant by itself, but can modulate the effect of the number of foreign
keys. Following Schneidewind (1997) RD can be classified as a dominant metric,
and DRT is not needed to classify quality, is a redundant metric.
It is important that software products, and obviously databases, are evaluated for
all relevant quality characteristics, using validated or widely accepted metrics.
These metrics could help designers, choosing between alternative semantically
equivalent schemata, to find the most maintainable one. Due of this, we think it
is very important to measure databases and understand their contribution to the
overall maintainability of IS.
For having useful metrics we use a method composed by three basic steps: the
metrics definition (using the GQM approach), the formal verification (using the
Zuse formal framework based on the measurement theory) and the empirical vali-
dation (doing a controlled experiment).
We have put forward different measures in order to measure the inter-table com-
plexity that affects the maintainability of the relational database schemata and con-
sequently control its quality.
The results obtained from the formal verification show that relational databases
measures assume, as object-oriented measures (Zuse, 1998), more complex proper-
ties related to concatenation operation than classic measures. These measures do
not assume an extensive structure but can be characterized above the ordinal scale
by fulfilling all the properties of the modified relation of belief.
However, in terms of software measurement, much research is needed (Neil,
1994), both from theoretical and from practical points of view (Glass, 1996). So, we
have carried out some experiments to validate the proposed metrics and more are
being developed at this moment. The presented experiment shows that the number
of foreign keys in a relational database schema is a solid indicator of its complexity
and that the length of the referential tree is not relevant by itself, but can modulate
the effect of the number of foreign keys. However, the controlled experiments have
TABLE ORIENTED METRICS FOR RELATIONAL DATABASES 93
problems (like the large number of variables that causes differences, dealing with
low level issues, microcosms of reality and small set of variables) and limits (do not
scale up, are done in a class in training situations, are made in vitro and face a
variety of threats of validity). Therefore, it may be more convenient to run multiple
studies, mixing controlled experiments with case studies. For these reasons, a more
deep empirical evaluation is under way in collaboration with industrial and public
organisations in “real-life” situations.
The metrics for relational databases are complemented with others for active
(Díaz and Piattini, 1999) and object-relational databases (Piattini et al., 1998).
Other interesting future research will be using these (and other) metrics for build-
ing prediction systems for database projects. In MacDonell et al. (1997) a pre-
diction system based on the number of entities, attributes and relationships of an
E/R schema combined with other 4GL-oriented measures (number of menus, edit
screens, reports, ) is shown.
A = A • >=
Once the mapping is established, mathematics and statistics can then be used to
process the information (e.g., working out means or variances). Measurement theory
also leads to conditions where numerical statements can be translated back into
94 PIATTINI, CALERO AND GENERO
empirical statements. To check whether the measure satisfies the users needs, Zuse
proposes an internal validation, based on the comparison between the empirical
interpretation of numbers and the empirical statements in the real world.
The combination rule must be defined as
measure does not satisfy the modified extensive structure, the combination rule will
exist or not depending on the independence conditions. When a measure assumes
the independence conditions but not the modified extensive structure, the scale type
is the ordinal scale.
Acknowledgments
The authors thanks the anonymous referees for the careful reading and constructive
criticism. This research is part of the MANTICA project, partially supported by
the CICYT and the European Union (CICYT-1FD97-0168) and by the CALIDAT
project carried out by Cronos Ibérica (supported by the Consejería de Educación
de la Comunidad de Madrid, Nr. 09/0013/1999).
References
Basili, V.R. and Weiss, D.M. 1984. A methodology for collecting valid software engineering data, IEEE
Trans. Software Eng. SE-10(6).
Bourque P. and Côte V. 1991. An experiment in software sizing with structured analysis metrics, J. Systems
Software 15: 159–172.
Briand L., Bunse C., Daly J., and Differing C. 1997. An experimental comparison of the maintainability
of object-oriented and structured design documents. In Harrold, M.J., and Vissagid G. Eds., Proc.
Int. Conf. on Software Maintenance, Bari, 1–3 October, pp. 130–138.
Briand, L.C., Morasca, S., and Basili, V. 1996. Property-based software engineering measurement, IEEE
Trans. on Software Eng. 22(1): 68–85.
Brilliant, S.S. and Kinght, J.C. 1999. Empirical research in software engineering, ACM Sigsoft 24(3):
45–52
Calero, C., Piattini, M., Genero, M., Serrano, M., and Caballero, I. 2000. Metrics for Relational Databases
Maintainability, UKAIS2000, Cardiff, UK, pp. 109–119.
Card, D.N. and Glas, R.L. 1990. Measuring Software Design Quality, Englewood Cliffs, Prentice Hall.
Churcher, N.J. and Shepperd, M.J. 1995. Comments on “A metrics suite for object-oriented design,”
IEEE Trans. Software Eng. 21(3): 263–265.
Codd, E.F. 1970. A relational model of data for larged shared data banks, CACM 13(6): 377–387.
Díaz, O. and Piattini, M. 1999. Metrics for Active Databases Maintainability, CAISE’99. Heidelberg, June
16–18.
Elmasri, R. and Navathe, S. 1999. Fundamentals of Database Systems, 3rd ed., Massachussets, Addison-
Wesley.
Fenton, N. 1994. Software measurement: A necessary scientific basis, IEEE Trans. on Software Eng. 20(3):
199–206.
Fenton, N. and Pfleeger, S.L. 1997. Software Metrics: A Rigorous Approach, 2nd ed., London, Chapman
& Hall.
Glass, R. 1996. The relationship between theory and practice in software engineering, IEEE Software,
November, 39(11): 11–13.
Gray, R.H.M., Carey, B.N., McGlynn, N.A., and Pengelly. A.D. 1991, Design metrics for database sys-
tems, BT Tech. J. 9(4): 69–79
Henderson-Sellers, B. 1996. Object-Oriented Metrics—Measures of Complexity, Upper Saddle River, NJ,
Prentice-Hall.
ISO. 1994. Software product evaluation-quality characteristics and guidelines for their use. ISO/IEC
Standard 9126, Geneva.
96 PIATTINI, CALERO AND GENERO
Kitchenham, B. and Stell, J.G. 1997. The danger of using axioms in software metrics, IEE Proc.-Softw.
Eng. 144(5–6): 279–285.
Li, H.F. and Chen, W.K. 1987. An empirical study of software metrics, IEEE Trans. on Software Eng.
13(6): 679–708.
MacDonell, S. G., Shepperd, M. J., and Sallis, P. J. 1997. Metrics for Database Systems: An empirical
study. Proc. Fourth Int. Software Metrics Symp.—Metrics’97, Albuquerque. IEEE Computer Society,
pp. 99–107.
Melton, A. (ed.) 1996. Software Measurement, London, International Thomson Computer Press.
Neil, M. 1994. Measurement as an alternative to bureaucracy for the achievement of software quality,
Software Quality J. 3(2): 65–78.
Pfleeger, S.L. 1995. Experimental design and analysis in software engineering, Ann. Software Eng., JC
Baltzer AG, Science Publishers, pp. 219–253.
Piattini, M., Calero, C., Polo, M., and Ruiz, F. 1998. Maintainability in object-relational databases, in
Van Huysduynen and Peeters (eds.), Proc. of The European Software Measurement Conf. FESMA 98,
Antwerp, May 6–8, Coombes, pp. 223–230.
Pigoski, T.M. 1997. Practical Software Maintenance, New York, Wiley Computer Publishing.
Rohatgi, V.K. (1976). An Introduction to Probability Theory and Mathematical Statistics, Wiley Series in
Probability and Mathematical Statistics, New York, Wiley.
Schneidewind N.F. 1997. Software metrics for quality control. Proc. of the Fourth Int. Software Metrics
Symp., IEEE Computer Society Technical Council on Software Engineering, pp. 127–136.
Sneed, H.M. and Foshag, O. 1998. Measuring legacy database structures. Proc. European Software Mea-
surement Conf. FESMA 98, Antwerp, May 6–8, Coombes, Van Huysduynen, and Peeters (eds.),
pp. 199–211.
Weyuker, E.J. 1988. Evaluating software complexity measures, IEEE Trans. Software Eng. 14(9): 1357–
1365.
Zuse, H. 1998. A Framework of Software Measurement, Berlin, Walter de Gruyter.
Mario Piattini received the MSc and PhD in Computer Science from the Politechnical University of
Madrid. Certified Information System Auditor from ISACA (Information System Audit and Control
Association). He is an Associate Professor at the Escuela Superior de Informática of the Castilla-La
Mancha University. He is the author of several books and papers on databases, software engineering and
information systems. He leads the ALARCOS research group of the Department of Computer Science
at the University of Castilla-La Mancha, in Ciudad Real, Spain. His research interests are advanced
database design, database quality, software metrics, object oriented metrics, software maintenance.
TABLE ORIENTED METRICS FOR RELATIONAL DATABASES 97
Coral Calero received the PhD in Computer Science, from University of Castilla-La Mancha. She is
an Assistant Professor at the Escuela Superior de Informática of the Castilla-La Mancha University in
Ciudad Real. She is a member of the Alarcos Research Group, in the same University, specialized in
Information Systems, Databases and Software Engineering. She is working on Metrics for Advanced
Databases. She is the author of articles and papers in national and international conferences on this
subject. She belongs to the ATI association and is a member of its Quality Group.
Marcela Genero is Assistant Professor at the Department of Computer Science in the University of
Comahue, in Neuquén, Argentine. She received her MS degree in Computer Science from the National
University of South, Argentine in 1989. Actually, she is a PhD student at the University of Castilla-La
Mancha, in Ciudad Real, Spain. Her research interests are advanced databases design, software metrics,
object oriented metrics, conceptual data models quality, database quality.