Testing Satisfaction of Functional Dependencies - peter honeyman

32 downloads 0 Views 506KB Size Report
time algorithm for testing satisfaction is then developed. 2. Definitions and .... are satisfied. Yet, we insist that any definition of satisfaction that admits this case is.
Testing Satisfaction of Functional Dependencies PETER HONEYMAN Bell Laboratortes, Murray Htll. New Jersey

Abstract D e t e r m m m g whether a single relation satisfies a set of funcnonal dependencies is a straightforward task However, determining whether a set of relations sattsfies a set of functional dependencies is a more d~fficult problem Even the meaning of th~s notion of "satisfaction" needs to be settled Several definitions for sat~sfactton are considered, one of which is determmed to be most sound This definition requires that one can construct a single relatton that satisfies the dependencies while containing all of the information m the set of relations A polynomial-time algorithm as then developed to test satisfacnon using this definition Categories and Subject Descriptors H 2 1 [Database Management] Logical Design General T e r m s Algorithms, Theory Additional Key Words and Phrases Relational database, computational complexity, congruence closure

1. Introduction Semantic constraints play an important role in the design and implementation of relational database systems. Important among these constraints ts the functional dependency. Informally, a functional dependency is a statement to the effect that the values associated wtth one set of attributes uniquely determine the values associated wtth another attribute set. When the database consists of a single relation, determining whether functional dependencies are satisfied lS straightforward. If many relations are present, testmg satisfaction presents certain problems, among these deciding what we mean by satisfaction. Even with a suitable definmon in hand, an efficient algorithm for testing satisfaction remains to be found. The rest o f this paper is organized as follows. After defining the necessary terms, several definttions for sansfaction are considered. We argue that one of them is intuitively most sound, comciding with the others in sensible places A polynomialtime algorithm for testing satisfaction is then developed.

2. Definitions and Background In what follows, individual attributes are represented by A, B, C, ... whde sets o f attributes have names selected from ... X, Y, Z. In representing a set of attributes, c o m m a s and set braces are elided, so that, for example, {A~, A._,. . . . .

An} is written

This work was supported m part by the National Science Foundation under Grant MCS 79-04528 at Princeton Umverslty Author's address Bell Laboratories, Murray Hdl, NJ 07974 Permission to copy w~thout fee all or part o f thin material ~s granted provtded that the cop~es are not made or dtstnbuted for direct commercml advantage, the A C M copyright nottce and the t~tle of the pubhcat~on and ~ts date appear, and notice is gtven that copying is by permission of the Association for C o m p u t m g Machinery To copy otherwise, or to repubhsh, requires a fee a n d / o r specific permission © 1982 A C M 0004-5411/82/0700-0668 $00 75 Journal of the Associationfor ComputingMachinery,Vol 29, No 3. July 1982.pp 668-677

Testing Satisfaction of Functional Dependencies

669

A 1A2 • • • An. The union of sets o f attributes is also represented by concatenation; for example, X U Y U Z is written XYZ. The cardinality of a set S is denoted I S I- Where necessary to express complexity results, II S II denotes the length (in bits) of the representation o f S. Thus IIs II is (within a constant factor) the number o f characters needed to write down S. 2.1 RELATIONS. The basis of the definitions that follow is the notion of an attribute. An attribute is like a data type; it acts as a classification device for a set of values. A relation scheme is a finite set of attributes. A relation scheme describes the format of a particular relation; it can be thought of as the data structure for a relation, or as a compound data type. A database is a pair o f finite sets (R, r), where r is a set of relations and R is a set of relation schemes describing r. R is called the database scheme. The structure of each relation in r is described by exactly one m e m b e r o f R, and vice versa, mutatis mutandis. Thus R and r are in 1-1 correspondence. Associated with each attribute A is a domain of values, dom(A). IfA1Az . . . A , is the scheme for relation r, then r can be viewed as a finite subset of dom(Al) x dom(A2) x . . . × dom(A,). Formally, a relation over scheme R is a finite set o f tuples over scheme R, where a tuple over scheme AIA~ . . . A , is a set # of mappings from A, into dora(A,), 1

Suggest Documents