Download The Expressive Power Hierarchy

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Microsoft SQL Server wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

PL/SQL wikipedia , lookup

Concurrency control wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Relational algebra wikipedia , lookup

SQL wikipedia , lookup

Functional Database Model wikipedia , lookup

Database wikipedia , lookup

ContactPoint wikipedia , lookup

Versant Object Database wikipedia , lookup

Clusterpoint wikipedia , lookup

Database model wikipedia , lookup

Relational model wikipedia , lookup

Transcript
Sec: 8.7
Expressive Power and Data Complexity
The Expressive Power Hierarchy
{3{
CZ
1. Stratied safe Datalog is equivalent to RA + xpoint (on
monotonic RA)
2. Safe, stratied Datalog expresses every DB-PTIME query if
we assume that there exists a total order in the databases
(thus it is DB-PTIME complete).
3. Order-independence property of queries (genericity):
queries are insensitive to the renaming of constants.
4. To be able to express all DB-PTIME queries Under genericity,
a non-deterministic construct such as choice is needed:
Stratied Datalog with choice is DB-PTIME-complete.
5. Safe Datalog (without function symbols) can express exponential queries, using non-stratied negation and stable model
semantics (to be discussed later)
6. Function symbols and recursion are needed for Turing completeness.
Zaniolo|Ceri|Faloutsos|Snodgrass|Subrahmanian| Zicari|All Rights Reserved
Advanced Database Systems
Morgan Kaufmann
Copyright c 1997
Sec: 8.7
Expressive Power and Data Complexity
Polynomial Data Complexity
{2{
CZ
1. Use Turing machines as the general model of computation
and encode the database as a tape of length n
2. Then any computable function on the database can be encoded as a Turing machine
3. some of these machines halt (complete their computation),
in O(n) steps, other in an an exponential number of steps,
others never terminate.
4. The set machines that halt in a number of steps which is
polynomial in n denes the class of DB-PTIME functions.
Are relational algebra expressions ('safe relational calculus' safe
non-recursive Datalog) evaluable in DB-PTIME?
Yes, and actually we use indices and query optimizers to
keep exponents and coecient small.
But these languages cannot express DB-PTIME. For instance
they cannot express transitive closures, or aggregates (thus the
most frequently used aggregates were added to SQL in ad hoc
fashion).
Zaniolo|Ceri|Faloutsos|Snodgrass|Subrahmanian| Zicari|All Rights Reserved
Advanced Database Systems
Morgan Kaufmann
Copyright c 1997
Sec: 8.7
Expressive Power and Data Complexity
Expressive Power
{1{
CZ
1. Expressive Power of a language: the set of functions that can
be written as programs of the language.
2. Data Complexity: query languages are viewed as mappings
from the DB to the answer. The big O is evaluated in terms
of the size of the database, which is always nite.
The following languages are equivalent w.r.t. expressive power:
1. Relational Algebra expressions
2. Safe relational calculus queries (tuple or domain)
3. Datalog with Safe non-recursive rules.
Any language that is at least as powerful as these is said to be relationally complete. Query languages must be relationally complete (Codd{1970).
But relational completeness is not enough. For instance setaggregates are beyond relational completeness, and had to be
added to SQL in ad-hoc fashion.
Question: what is a reasonable requirement for a query language?
DB-PTIME completeness might be the answer.
Zaniolo|Ceri|Faloutsos|Snodgrass|Subrahmanian| Zicari|All Rights Reserved
Advanced Database Systems
Morgan Kaufmann
Copyright c 1997