On Impossibility of Decremental Recomputation of Recursive Queries in Relational Calculus and SQL

We study the problem of maintaining recursively-de(cid:12)ned views, such as the transitive closure of a relation, in traditional relational languages that do not have recursion mechanisms. In particular, we show that the transitive closure cannot be maintained in relational calculus under deletion of edges. We use new proof techniques to show this result. These proof techniques generalize to other languages, for example, to the language for nested relations that also contains a number of aggregate functions. Such a language is considered in this paper as a theoretical reconstruction of SQL. Our proof techniques also generalize to other recursive queries. Consequently, we show that a number of recursive queries cannot be maintained in an SQL-like language. We show that this continues to be true in the presence of certain auxiliary relations. We also relate the complexity of updating transitive closure to that of updating the same-generation query and show that the latter is strictly harder than the former. Then we extend this result to that of updating queries based on context-free sets.


Problem Statement and Summary
It is well known that relational calculus (equivalently, rst-order logic) cannot express recursive queries such as transitive closure 1].However, in a real database system, it is reasonable to store both the relation and its transitive closure and update the latter whenever edges are added to or removed from the former.Doing this is known under the name of view maintenance.In this paper we consider the problem of whether the above update problem for maintaining transitive closure and other recursive queries can be accomplished using relational calculus or using its practical SQL-like extensions.We also compare the complexity of maintaining transitive closure against the complexity of maintaining \same generation" and context-free chain queries.In this paper, we use the letter R to denote a binary relation, and R + to denote its transitive closure.It can be proved 6,2] that given R, R + , and a new edge (x; y) to be added to R, the transitive closure R +  +(x;y) of R f(x; y)g can be expressed in rst-order logic and thus in relational calculus.In particular, for all u and v, R +  +(x;y) (u; v) i R + (u; v), or R + (u; x) and y = v, or u = x and R + (y; v), or R + (u; x) and R + (y; v).Thus transitive closure can be incrementally maintained in a relational database.The problem of updating the transitive closure after an edge has been removed is more di cult.The best positive solution so far is that of Dong and Su 5].They proved that if R is acyclic, then the transitive closure R + ?(x;y) of R with the edge (x; y) removed can be de ned in rst-order logic in terms of R, R + , and (x; y).Thus transitive closure can be decrementally maintained in a relational database provided the relation involved is acyclic.But this is not satisfactory because acyclicity cannot be tested in relational calculus 10].
Database Programming Languages, 1995 Another solution is that of Immerman and Patnaik 14].They proved that transitive closure of undirected graphs can always be maintained, provided some auxiliary ternary relations can be used.Dong and Su 7] strengthened this result further by showing that transitive closure of undirected graphs can be maintained using only auxiliary binary relations.They also showed that it cannot be done using only auxiliary unary relations.In Section 2, we prove that transitive closure cannot be decrementally maintained in a relational database in general.That is, R + ?(x;y) cannot be expressed in relational calculus in terms of R, R + , and (x; y) when R is a directed graph that is not necessarily acyclic.We also consider the problem of maintaining transitive closure in a context where some auxiliary relations are available.Dong and Su 7] also obtained results that are similar to ours.However, the proof techniques involved are very di erent.Most importantly, their proof technique is only applicable to the particular case of maintaining transitive closure in relational calculus.Ours is much simpler and can be generalized to more expressive languages and other recursive queries.In particular, instead of transitive closure, any query complete for DLOGSPACE can be used.In Section 3 we show that our technique extends naturally to prove that transitive closure cannot be decrementally maintained using query languages having the power of SQL.That is, we show that the availability of arithmetic operations and GROUP-BY does not help at all.We also extend this result in the presence of simple auxiliary relations.In addition, we exhibit a query that illustrates the additional power of using an SQL-like language incrementally.This query, which is inexpressible in SQL, is expressible incrementally in SQL with certain auxiliary relations but is not expressible incrementally in rst-order logic with the same auxiliary relations.In Section 4, we look at the complexity of maintainingtransitive closure against the complexity of maintaining other queries.We prove that it is strictly more di cult to maintain the \same generation" query than to maintain transitive closure.We are also able to generalize this result and show that maintaining context-free chain queries (in a certain sense to be de ned) is at least as hard as maintaining transitive closure.In Section 5 we extend our basic technique to show that the same-generation query cannot be maintained (incrementally or decrementally) in SQL-like languages.

Recomputation of Recursive Queries in Relational Calculus
The purpose of this section is to show that the transitive closure of a relation cannot be decrementally maintained in relational calculus or rst-order logic.That is, Theorem 2.1 There is no relational calculus expression that de nes the transitive closure R + ?(x;y) of R ?f(x; y)g in terms of a binary relation R, its transitive closure R + , and an edge (x; y).
We introduce a new proof technique that is di erent from 7].In particular, our technique does not rely on games and can be readily extended to other queries and languages.For example, we will show that the analog of Theorem 2.1 holds for a language having the expressive power of SQL.

2
Our rst proof is based on a result in rst-order logic, called the bounded degree property 13], that formalizes the intuition behind the fact that recursive queries are not rst-order de nable.It says that it is not possible Database Programming Languages, 1995 to de ne in rst-order logic a function that transforms a graph having small in-and out-degrees into a graph having a large number of in-and out-degrees.Let G = hV; Ei be a graph (binary relation).Throughout the paper, when we speak of graph queries, we assume that the nodes come from a countably in nite domain, and that equality is the only predicate available on the nodes.(Note the absence of order.)De ne in-deg(v) = card(fv 0 j (v 0 ; v) 2 Eg) and out-deg(v) = card(fv 0 j (v; v 0 ) 2 Eg).The degree set deg(G) of G is de ned as fin-deg(v) j v 2 V g fout-deg(v) j v 2 V g.De nition 2.3 Suppose for any function f from graphs to graphs that is de nable in a language L it is the case that for any number k there is a number c, depending on f and k, such that card(deg(f(G))) c for any graph G satisfying deg(G) f0; 1; : : :; kg.Then L is said to have the bounded degree property.2 Theorem 2.4 (see 13]) First-order logic has the bounded degree property.

2
One may prove that certain general recursive queries, such as transitive closure, cannot be expressed in rst-order logic.However, one may nd that a very di erent approach is needed to prove the same result for certain special cases of these queries, such as transitive closure of a chain.(This is in fact a class of queries that have the following property: when the input is a chain, they return its transitive closure).Using Theorem 2.4 many rst-order inexpressibility results and their special cases can be proved in a simple uniform manner.For example, Corollary 2.5 First-order logic cannot express the transitive closure of a chain.Proof.The degree set of a chain is f0; 1g.But the degree set of the transitive closure of a chain is f0;1; : : : ; ng, where n is the length of the chain.Then the corollary follows by Theorem 2.4. 2 Making use of Corollary 2.5, we can now present our Proof of Theorem 2.1.Let R be a single cycle and (x; y) be the edge to be removed.Assume that R + ?(x;y) is de nable in rst-order logic.That is, there is a formula R; R + ; x; y; u; v] such that for all u and v: (1) R + ?(x;y) (u; v) i R; R + ; x; y; u; v] In this formula every quanti er is of form 8z 2 V or 9z 2 V where V is the set of nodes of R (and R + ).As the transitive closure of a single cycle is a complete graph, every R + (x 0 ; y 0 ) in R; R + ; x;y; u; v] can be replaced by true so that (1) continues to hold.This replacement results in a formula 0 R; x; y; u; v] in which R + does not appear.So we have R + ?(x;y) (u; v) i 0 R; x;y; u; v] Now, we prove that (2) implies that transitive closure of a chain is rst-order de nable.Let P be a binary relation symbol to be interpreted as a chain.Let end(y 0 ) be a rst-order formula in terms of P saying that y 0 has out-degree zero in P and let start(y 0 ) be a rst-order formula in terms of P saying that y 0 has in-degree zero in P. De ne 00 P;x; y; u; v] as 0 R; x; y; u; v] in which R(z; z 0 ) is replaced by P(z; z 0 ) _ (end(z) ^start(z 0 )).Let P;u; v] be 9x9y:end(x) ^start(y) ^ 00 P;x; y; u; v].According to (2), if P is interpreted as a chain, then P; u; v] holds i there is an edge from u to v in the transitive closure of a graph obtained from P by rst inserting an edge from end to start and then deleting it.That is, i there is an edge in the transitive closure of P. Hence, (2) implies that the transitive closure of a chain can be expressed in rst-order logic, contradicting Corollary 2.5.Thus R + ?(x;y) (u; v) is not rst-order de nable. 2

Generalizations
Our proof is based on three assumptions.First, a query Q, whose unmaintainability we must prove, has the following property: whenever Q is applied to a chain, it produces the transitive closure of that chain.
Database Programming Languages, 1995 Second, the language must contain a sublanguage as expressive as rst-order logic.Third, the transitive closure of a chain is not de nable in the language.Summing up, we see from the proof of Theorem 2.1 that the following is true.
Theorem 2.6 Let L be a language that contains a sublanguage as expressive as relational calculus, but that cannot express the transitive closure of a chain.Let Q be any graph query that computes the transitive closure of a chain.Then it is impossible to write a query in L that, when applied to a binary relation R, an edge (x; y) in R, and Q(R), will produce Q(R ?f(x; y)g).In other words, Q cannot be decrementally maintained in L.

Using Auxiliary Relations
Our negative result merely says that the transitive closure R + of a relation R cannot be maintained using relational calculus when an edge (x; y) is removed from that relation.It says nothing about whether it is possible to maintain R + when some additional auxiliary relations are present.The availability of auxiliary relations { which must themselves be maintainable using relational calculus under edge insertion and deletion { can make a di erence.For example, Dong and Su 5] show that for a special kind of cyclic graphs R, where there is at most one path connecting any two vertices, R + can be maintained when an auxiliary relation storing a maximal acyclic subgraph of R is provided.However, the general situation remains open.
Open Problem 2.8 Is there a k-ary property A R of a binary relation R such that both R + ?(x;y) and A R?f(x;y)g can be expressed using rst-order formulae in terms of R, R + , A R , and (x; y)?
Note that a property is required to be name-independent or generic: if A R (x 1 ; : : :; x n ) holds, then A (R) ( (x 1 ); : : :; (x n )) is required to hold for any automorphism of R's nodes.For k = 1 (unary predicates), this problem is easily resolved.
Theorem 2.9 There is no unary property A R of a binary relation R such that both R + ?(x;y) and A R?f(x;y)g can be expressed using rst-order formulae in terms of R, R + , A R , and (x; y).
Proof.Database Programming Languages, 1995 the former is the case.Then, for any m, there is a single cycle R of length m such that AR holds for every node in R. Let 0 be obtained from be replacing AR(v) by true.Then, according to (3), for in nitely many non-isomorphic single cycles, R + ?(x;y) (u; v) holds i 0 R; x; y; u; v] where 0 now is a rst-order formula.
Using this fact and the same argument as in the second proof of Theorem 2.1, we obtain a rst-order formula that, for in nitely many non-isomorphic chains, computes their transitive closure.But this contradicts the bounded degree property, thus proving the theorem. 2 For the situation where the arity of auxiliary relations is 2 or greater, we can only resolve certain special cases.For example, let E R (x; y; u; v) be a 4-ary property saying that every path in R from u to v must go through the edge (x; y), where x = u and y = v do not hold simultaneously.It is possible to maintain the transitive closure of some cyclic relations using this E R .That is, R + ?(x;y) can be de ned in terms of R; R + , E R , and (x; y).However, we have to address the decremental maintenance of E R itself.Again, relational calculus does not provide us with su cient expressive power to do so.Theorem 2.10 There exists a class of relations R such that neither R + nor E R can be maintained decrementally.
Proof.Consider the following relation R. Let R0 be a single cycle.R is obtained from it by adding two new nodes, x and y, the edge (x; y), and edges (z; x), (x;z), (z;y), (y; z) for all z on the cycle R0.Note that ER is empty because there are at least two alternative paths between any two nodes in R that are not connected by an edge.The inability to maintain R + decrementally, given R, R + and ER follows immediately.Since R + is a complete graph and ER is empty, they can be safely replaced by constants.If the transitive closure of R were decrementally maintainable, we could have written a rst-order formula for calculating the transitive closure of a chain obtained from R by deleting (x; y) and then any edge (z;z 0 ) on the cycle.To see that this impossible, consider an arbitrary chain C with endpoints x and y, and de ne the new graph R by making C ? fx;yg into a cycle and adding edges (z;x), (x; z), (z;y), (y; z) for all z 2 C ? fx;yg.Maintainability of R + now implies that the transitive closure of C ? fx;yg is rst-order de nable, but this contradicts the bounded degree property.
To show that ER cannot be maintained decrementally, note that if it were, we would be able to de ne, in relational calculus, E R 0 , for R 0 a single cycle.Indeed, if such E R 0 were de nable, we would be able to de ne the transitive closure of a chain by adding the edge from the end to the start to make a single cycle and then, for any two nodes x and y, checking if this added edge is on the path from x to y. 2 3 Recomputation of Recursive Queries in SQL In the preceding sections, rst-order logic was used as the ambient language.However, real database query languages are richer and more powerful than relational algebra.In particular, the de-facto practical query language SQL has a GROUP-BY operator, arithmetic operators, and aggregate functions.These extra primitives give these languages extra power; for example, they can test whether a set of numbers has even or odd cardinality 12].In this section, we consider decremental recomputation of transitive closure in these more practical languages.First, we de ne a \theoretical SQL", which is a formally presented language that has the main features that distinguish SQL from relational calculus.Then we prove analogs of our negative results for this language.

A Theoretical Reconstruction of SQL
As we mentioned, there are two main features that make SQL more expressive that rst-order logic.First, SQL allows nesting by using the GROUP-BY operator.Second, SQL has arithmetic operations and a number of aggregate functions.
Database Programming Languages, 1995 On Impossibility of Decremental Recomputation of Recursive Queries in Relational Calculus and SQL It was proposed in 12] to use the language NRL aggr as a theoretical language to study the expressive power of SQL.It is obtained from the nested relational algebra (which is a standard language for manipulating complex objects, see 3,4,15]) by adding simple rational arithmetic operators +, ?, , and ; a summation construct P (f)(fx 1 ; : : :; x n g) = f(x 1 ) + : : : + f(x n ); and the usual linear order on rational numbers rat .
It was shown 12] that NRL aggr can express aggregate functions and grouping operations found in SQL.Moreover, the same paper showed that expressibility in NRL aggr is independent of the depth of nesting of sets in intermediate data.
This implies, under the normal semantics used in database query languages, that a query in NRL aggr over at relations can always be translated into a query in rst-order logic augmented with the same operators.
In other words, NRL aggr and (most variations of) SQL coincide in expressible power, as far as at relations are concerned.Thus we can investigate decremental recomputation of recursive queries in the context of NRL aggr instead.

Expressive Power of SQL
The main result of this section is that decremental recomputation of transitive closure remains inexpressible in NRL aggr .Our proof uses a nite-co niteness result in nested relational algebra 13], which says that it is impossible to de ne a query in NRL aggr that distinguishes members of a family of graphs called k-multicycles.In essence, this theorem says that we cannot use NRL aggr to distinguish one k-multi-cycle from another, provided the cycles are su ciently long.Note that this result remains valid even when we restrict ourselves to subclasses of k-multi-cycles having some xed number of cycles.For example, it continues to hold when we replaced k-multi-cycles by single cycles of length at least k.Many inexpressibility results can be obtained from this theorem in a trivial manner.In particular, Corollary 3.3 NRL aggr is unable to express the transitive closure of a chain.Proof.Suppose the transitive closure of a chain can be expressed in this language.Then testing whether a graph is a chain can also be expressed in this language; see 13].Then testing whether a k-multi-cycle contains exactly one cycle can be expressed, too.However, this contradicts Theorem 3.2.Therefore, the transitive closure of a chain is inexpressible in NRL aggr .

2
Database Programming Languages, 1995 The main result of this section follows immediately from Theorem 2.6 and Corollary 3.3.
Theorem 3.4 It is impossible to recompute (deterministic) transitive closure decrementally in NRL aggr . 2 One has to be careful when formulating an analog of Open Problem 2.8 for NRL aggr .If we simply ask whether it is possible to maintain transitive closure decrementally using additional space, the answer to this question is positive.Indeed, as auxiliary object we store a (nested) relation that contains transitive closure for each subrelation of R, together with a list of edges deleted from R to obtain this subrelation.Then transitive closure can easily be recomputed.However, this naive approach requires exponential space.We still do not know whether the following is true.
Open Problem 3.5 Is it possible to recompute transitive closure decrementally in SQL using polynomial auxiliary space?
One instance of this problem can be resolved using the methods as in the proof of Theorem 2.9.
Theorem 3.6 There is no unary property A R of a binary relation R such that both R + ?(x;y) and A R?f(x;y)g can be expressed using NRL aggr in terms of R, R + , A R , and (x; y). 2

SQL vs Relational Calculus
In this subsection we compare the incremental evaluation power of NRL aggr with that of rst-order logic and with that of NRL aggr without incremental evaluation.In particular, we provide an example query that is expressible in the rst language but not in the other two languages.
The example is as follows.Let S and R be two arbitrary graphs.Let x and y be two arbitrary nodes in S and R respectively.Does x reach more nodes than y?We denote this query by moreproli c S;R (x; y).
On Impossibility of Decremental Recomputation of Recursive Queries in Relational Calculus and SQL Therefore, using NRL aggr in an incremental/decremental way does provide some desirable extra expressive power.

Context-Free Chain Queries
A frequently considered class of queries is the class of chain queries.Consider databases as labeled graphs.A chain query Q L;G retrieves pairs of nodes between which there exists a walk (edge sequence, not necessarily a path) in G having some particular kind of label patterns speci ed by a context-free set L. For example, for the transitive closure query the patterns are speci ed by the regular set fA n j n > 0g, where A is a unique label.
We also consider the same-generation query over a graph G having two label symbols A and B. Such a graph can be conveniently represented by two relations, one for edges labeled A and the other for edges labeled B, which need not be disjoint.We use A and B to name these two relations.Then we write SG A;B (x; y) i there is a z such that there is a walk from x to z in A and a walk from z to y in B that are equal in length.
The same-generation is a chain query; it is speci ed by the context-free set fA n B n j n > 0g.
It is known that every chain query whose label patterns are speci ed by a regular set allows query recomputation after insertion using rst-order logic 6,8].It is open whether this is true for any chain query whose label patterns are speci ed by an arbitrary context-free set.The same-generation query, as a special case of a context-free set, is known to be unmaintainable using rst-order logic under insertion of edges if auxiliary relations are not allowed 8] and this remains true when unary auxiliary relations are allowed 7].A generalization of these two results to SQL-like languages is given in Section 5.
It is an open problem if incremental maintenance of the same-generation query is possible when polynomial auxiliary space are allowed.The purpose of this section is to compare the complexity of decremental recomputation of transitive closure with that of context-free chain queries, in particular, the same-generation query.
De nition 4.1 Given two graph queries, Q 1 and Q 2 , we say that 1. Q 1 is strictly harder than Q 2 if, whenever Q 1 can be decrementally maintained in a language L having relational calculus as a sublanguage, then so can Q 2 , and there is an in nite class of graphs on which Q 2 can be decrementally maintained in relational calculus, but Q 1 cannot.
2. Q 1 is linearly easier than Q 2 if there exists a linear function f such that Q 1 can be decrementally maintained with auxiliary relations of arity up to f(k) whenever Q 2 can be decrementally maintained with auxiliary relations of arity up to k. 2 Proposition 4.2 The same-generation query is strictly harder than the transitive closure query.
Proof.The same-generation query over acyclic databases cannot be decrementally maintained using rst-order logic with at most unary auxiliary relations 7].The transitive closure query over acyclic databases can be decrementally maintained using rst-order logic with no auxiliary relations 5].To conclude the proof, observe that R + (x; y) i SG R;f(v;v) j v is a node in Rg (x; y).That is, we use R as the A relation and f(v; v) j v is a node of Rg as the B relation of SGA;B.If we can maintain SGA;B, then we can clearly maintain R + . 2 Theorem 4.3 The transitive closure query is linearly easier than every chain query Q L;G , where L is innite.
Proof Sketch.Suppose L is an in nite context-free set.Then by the pumping lemma, there exist strings , , , , such that is not empty and the set f n n j n 1g is contained in L. We maintain the transitive closure of R by maintaining the answer to QL;G using the reduction described below and depicted in Figure 1.
Database Programming Languages, 1995 Clearly, this reduction can be maintained in rst-order logic.Furthermore, R + (x;y) i (1) x 6 = y and QL;G((^ ; x); (^ ; y)), (2) x = y and R(x; y), or (3) x = y and there is z 6 = x such that QL;G((^ ; x);(^ ; z)) and QL;G((^ ; z); (^ ; y)).From the above, the following upper bounds are clear.If the rst-order logic formulae that maintain QL;G do not use auxiliary relations, then the formulae for maintaining transitive closure constructed by this reduction need only a 4-ary auxiliary relation.If the rst-order logic formulae that maintain QL;G use at most k-ary auxiliary relations, then the formulae for maintaining transitive closure constructed by this reduction need at most 2k-ary auxiliary relations, plus a 4-ary auxiliary relation.Hence f can be taken to be a linear function dominating max(2k; 4).
For the situation where the length of is m and some of , , , , is not a letter, we employ m di erent constants to tag the nodes of R using a similar construction, with minor adjustments if some of , , , , is empty. 2 Finally, we observe that all the transformations employed earlier are rst-order and thus Corollary 4.4 Analog of Theorem 4.3 holds when we use the at fragment of NRL aggr instead of rst-order logic.

5 Impossibility of Recomputation of Same-Generation in SQL
It was previously known that the same-generation query cannot be maintained, without auxiliary space, using rst-order logic when edges are inserted or deleted 7].These previous results were proved using games and thus cannot be extended to SQL-like languages.In this section, we give a further demonstration of the advantage of our technique.We extend the above results to any language that contains rst-order logic as a sublanguage but is nite-co nite on single-cycle queries.Then the inability of SQL to maintain the same-generation query without auxiliary space falls out as an immediate corollary.
De nition 5.1 A language L is called cycle-simple if it contains relational calculus as a sublanguage but cannot express properties of single cycles that are both in nite and coin nite.That is, for any Boolean query f in L, there exists a number n such that either f is true for any single cycle of length n, or f is false for any single cycle of length n. 2 Database Programming Languages, 1995 Let us rst obtain a property on a special kind of graphs called two-chain graph that is true of any cyclesimple language.
De nition 5.2 A two-chain graph is a graph consisting of two unconnected chains.Proposition 5.3 Let L be a cycle-simple language.Then L cannot test the property P of two-chain graphs.
Proof.Note that a single cycle G of length more than 6 is of even length i the following is true.There are non-consecutive edges in G such that removal of them from G results in a two-chain graph satisfying P. Thus, if P were L-de nable, being of even length can be tested on single cycles of length more than 6 as follows: 9x9y9u9v Using this result, we can prove that such a language L cannot increment the same-generation query.Theorem 5.4 Let L be a cycle-simple language.Then it cannot maintain the same-generation query under edge insertion without using auxiliary relations.
Proof.Let R c denote the graph obtained by reversing the edges in R.That is, R c (u; v) i R(v; u).Consider the two-chain graph R depicted below.Then SGR;Rc is a diagonal graph.That is SGR;Rc(u; v) i u = v and u is a node of R. Suppose L can maintain the same-generation query when edges are inserted.Then we have a formula SGR;Rc ; R; x; y; u; v] in L such that SG R f(x;y)g;R c f(y;x)g (u; v) i SGR;Rc; R; x; y; u; v].
Since SGR;Rc is a diagonal, every occurrence of SGR;Rc(x 0 ; y 0 ) in SGR;Rc ; R; x; y; u; v] can be replaced by the formula (x 0 = y 0 ) ^(9z 0 :R(x 0 ; z 0 ) _ R(z 0 ; x 0 )).So we obtain a formula 0 R; x;y; u; v] in which SGR;Rc does not appear such that SG R f(x;y)g;R c f(y;x)g (u; v) i 0 R; x; y; u; v].Now consider the following formula (u; v): This formula says that u is an endpoint (has outdegree zero), and v is a predecessor of an endpoint di erent from u.In other words, holds i R has the property P. Since L contains a sublanguage equivalent to the relational calculus and all transformations above are rst-order, we conclude that under the assumption that SG is incrementally maintainable, L can test the property P.But this contradicts proposition 5.3.This proves the theorem.

2
Not only is L unable to maintain the same-generation query under edge insertion, it is also unable to maintain the same-generation query under edge deletion.
Theorem 5.5 Let L be a language that contains relational calculus as a sublanguage but cannot express the transitive closure of a chain.Then it cannot maintain the same-generation query under edge deletion without using auxiliary relations.
Proof sketch.Suppose R is a single cycle having an odd number of edges.Then it is easy to see that SGR;R is a complete graph.Consider deleting an edge (x; y) from R. Notice that the transitive closure of the chain R ?f(x;y)g is expressible as R + ?(x;y) (u; v) i SG R?f(x;y)g;R?f(x;y)g (u; v), or SG R?f(x;y)g;R?f(x;y)g (u; z) and R(z; v) and (z;v) 6 = (x; y), or R(u; v) and (x; y) 6 = (u; v).If L can maintain the same-generation query when edges are deleted, then we have a formula R; SGR;R; x; y; u; v] in L such that for all u and v: SG R?f(x;y)g;R?f(x;y)g (u; v) i R;SGR;R; x; y; u; v] Since SGR;R is a complete graph, we can replace every occurrence of SGR;R(x 0 ; y 0 ) by true so that (4) continues to hold.This replacement results in a formula 0 R; x;y; u; v] in which SGR;R does not appear.So we have SG R?f(x;y)g;R?f(x;y)g (u; v) i 0 R; x; y; u; v].This implies that the transitive closure of the chain R ?f(x;y)g is denable in L. It is not hard to show that then transitive closure of any chain is de nable in L, which is a contradiction.

2
Combining Theorem 5.4, Theorem 3.2, Theorem 5.5, and Corollary 3.3, we conclude that SQL-like languages cannot maintain the same-generation query under insertion and deletion of edges.
Corollary 5.6 NRL aggr cannot maintain the same-generation query under insertion and deletion of edges without using auxiliary relations.

6 Remarks
Our proof of impossibility of decremental maintenance of transitive closure assumes the existence of a formula that decrements transitive closure.It then analyzes this formula under the assumption that the relation supplied is a single cycle.By making this assumption, it is allowed to simplify the formula.The resultant is a formula that expresses a query that is shown to be inexpressible in rst-order logic.
An additional interest in this proof is its use of a recently-developed general result called the bounded degree property 13].More signi cantly, it generalizes naturally to powerful and practical SQL-like languages by substituting the bounded degree property of rst-order logic with the nite-co niteness of queries on k-multicycles in these augmented languages 13].
The ease of extension from proofs for rst-order logic to SQL-like languages is a major distinguishing feature of the techniques in this paper from that of Dong and Su 7].One advantage of the techniques here is that they extend to SQL-like languages having arithmetics and aggregate functions readily, whereas the games technique 7] does not.In Section 5 we demonstrated this advantage again and proved that the same-generation query cannot be maintained using an SQL-like language when edges are added or deleted.
Database Programming Languages, 1995 Finally, the general case of maintaining transitive closure under edge deletion where no limit is placed on auxiliary relations (or polynomial space limit is placed in the case of nested relations) remains an interesting unsolved problem.

Figure 1 :
Figure 1: Transforming graph for R + to graph for Q L;G

2 LetP
be the following property of two-chain graphs: If lengths of two chains are n and m, then either n = m, or n = m ?2, or n = m + 2.
Assume that R is a single cycle.Because of genericity, either AR holds for each node of R, or AR fails + ?(x;y) (u; v) holds i R; AR; x; y; u; v] holds Since AR is generic, either fm j 9 single cycle R of length m such that AR holds for every node in Rg or fm j 9 single cycle R of length m such that AR does not hold for any node in Rg is in nite.Assume without loss of generality that