completeness of queries over sql databases
play

Completeness of Queries over SQL Databases Werner Nutt and Simon - PowerPoint PPT Presentation

Completeness of Queries over SQL Databases Werner Nutt and Simon Razniewski Introduction } Data Quality research investigates how good data is } Dimensions of Data Quality are: } Correctness } Timeliness } Completeness 2


  1. Completeness of Queries over SQL Databases Werner Nutt and Simon Razniewski

  2. Introduction } Data Quality research investigates how good data is } Dimensions of Data Quality are: } Correctness } Timeliness } Completeness 2 Completeness of Queries over SQL Databases 31.10.2012

  3. Completeness } Query answering over incomplete data: extensively studied } Codd: NULL values [1975] } Imielinski/Lipski: Representation systems [1984] } Query completeness: Little attention } Razniewski/Nutt: Only on missing records [VLDB 2011] 3 Completeness of Queries over SQL Databases 31.10.2012

  4. Bolzano is in the Province of South Tyrol Bolzano } Trilingual province in the north of Italy } Has its own school administration 4 Completeness of Queries over SQL Databases 31.10.2012

  5. Incompleteness in the school data Available Ideal database database Facts in real world Facts in school database result(Paul, ¡Music, ¡A) result(Paul, ¡ Music, ¡ NULL) result(Giulia, ¡Music, ¡A) Missing information in the school database: - no grade for Paul (missing value) - no entry for Giulia (missing record) 5 Completeness of Queries over SQL Databases 31.10.2012

  6. Consequence: Query answers are incorrect Query Q : ”How many pupils have grade A in Music?” result(Paul, ¡Music, ¡A) Q( ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡) ¡= ¡2 According to ideal database: result(Giulia, ¡Music, ¡A) Q( ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡) ¡= ¡0 result(Paul, ¡Music, ¡NULL) According to available database: à If data is incomplete, query answers become incorrect. 6 Completeness of Queries over SQL Databases 31.10.2012

  7. Use Metadata to guarantee completeness! ... vocational schools use Completeness cannot be checked by inspecting a database: the information system of the province ... primary schools } One cannot see what is missing! to manage grades took part in a survey of music education However, we may know whether parts of a db are complete, e.g., } “ The grades from vocational schools are complete ” } “ The Music grades from primary schools are complete ” è Idea: Assess completeness of a query using completeness assertions for (parts of) tables 7 Completeness of Queries over SQL Databases 31.10.2012

  8. Reasoning about query completeness Grades from I want to know vocational schools “How many pupils are complete have grade A in Music?“ Can I trust the query answer? All Music grades from primary schools are complete Biology grades You cannot , from high schools because Space of possible information are complete information about pupils from high Assertions about partial completeness schools could be missing 8 Completeness of Queries over SQL Databases 31.10.2012

  9. Reasoning about query completeness (2) Grades from I want to know vocational schools “How many pupils are complete at vocational schools have grade A in Music?“ Can I trust the query answer? All Music grades from primary schools 2. Reasoning are complete methods Biology grades You can , because from high schools Space of possible information all needed are complete 1. Formalization: information is • incomplete dbs Assertions about partial completeness complete in the • assertions about database db completeness 3. Implementation techniques [Demo today] 9 Completeness of Queries over SQL Databases 31.10.2012

  10. Running example: Schema result(name, ¡subject, ¡grade) pupil(name, ¡schoolName, ¡schoolType) 10 Completeness of Queries over SQL Databases 31.10.2012

  11. Formalization: Incomplete database When talking about incompleteness, we need a complete reference An incomplete database D is a pair of an ideal database D i ¡ and an available database D a D = ¡(D i , ¡D a ) such that each record in D a is less informative than some record in D i ¡ 11 Completeness of Queries over SQL Databases 31.10.2012

  12. Example: Incomplete database ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ D i D a less informative than result(Paul, ¡Music, ¡A) result(Paul, ¡Music, ¡NULL) result(Giulia, ¡Music, ¡A) pupil(Paul, ¡Verdi, ¡Voc) 12 Completeness of Queries over SQL Databases 31.10.2012

  13. Formalization: Query completeness [ Motro1989] Query Q “The answer to Q is complete“ Notation: Compl(Q) ¡ Semantics: (D i , ¡D a ) ¡⊨ ¡Compl(Q) ¡ ¡ ¡ ¡ ¡ ¡iff ¡ ¡ ¡ ¡ ¡ ¡ ¡Q(D i ) ¡= ¡Q(D a ) 13 Completeness of Queries over SQL Databases 31.10.2012

  14. Formalization: DB completeness Table completeness statement assert partial completeness of a db table. E.g., This is a tuple- “The available database contains generating all subjects taken by pupils at vocational schools“ dependency (TGD) Formally: ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ result i (n,s,g), ¡pupil i ¡ (n,sn, ¡Voc) ¡ ¡ ¡ à ¡ ¡ ¡ ¡ ¡ ∃ g‘ ¡ ¡result a ¡ (n,s,g‘) Every result of a pupil from a vocational school according to the ideal db is also in the available db (but the grade may be missing) 14 Completeness of Queries over SQL Databases 31.10.2012

  15. Example: DB completeness ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡result i (n,s,g), ¡pupil i ¡ (n,sn, ¡Voc) ¡ ¡ ¡ à ¡ ∃ g‘ ¡ ¡result a ¡ (n,s,g‘) holds over the incomplete database ¡(D i ,D a ) ¡ D a ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ D i result(Paul, ¡Music, ¡A) result(Giulia, ¡Music, ¡A) result(Paul, ¡Music, ¡NULL) pupil(Paul, ¡Verdi, ¡Voc) because ¡result(Paul, ¡Music, ¡NULL) ¡ is in ¡ ¡D a 15 Completeness of Queries over SQL Databases 31.10.2012

  16. The reasoning problem I want to know Grades from “How many pupils vocational schools at vocational schools are complete have taken Music?“ Can I trust the query answer? Table All Music grades from primary schools completeness Query Q Q are complete statements C C Biology grades from high schools Space of possible information are complete Assertions about partial completeness Does C imply Comp mpl(Q (Q) ? 16 Completeness of Queries over SQL Databases 31.10.2012

  17. Reasoning: The principle Query: “Pupils at vocational schools that took Music“ ¡ Q pupils (x):-­‑result(x, ¡Music, ¡g), ¡pupil(x, ¡sn, ¡Voc) 1. Assume Q pupils ¡ returns x‘ over D i 2. See which facts must be in D i … result(x‘, ¡Music, ¡ g‘ ) ¡ pupil(x‘, ¡sn‘, ¡Voc) ¡ … 17 Completeness of Queries over SQL Databases 31.10.2012

  18. Reasoning: The principle (2) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡D i ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡D a … … result(x‘, ¡Music, ¡ g‘ ) ¡ result(x‘, ¡Music, ¡NULL) pupil(x‘, ¡sn‘, ¡Voc) ¡ pupil ¡ (x‘, ¡sn‘, ¡Voc) … … 3. Use table completeness to derive facts in D a “All subjects taken by pupils at vocational schools there“ result i (n, ¡s, ¡g), ¡pupil i ¡ (n, ¡sn, ¡Voc) ¡ à ¡ ∃ g‘ ¡result a ¡ (n, ¡s, ¡g‘) “All pupils there“ pupil i ¡ (n, ¡sn, ¡st) ¡ à ¡pupil a ¡ (n, ¡sn, ¡st) 18 Completeness of Queries over SQL Databases 31.10.2012

  19. Reasoning: The principle (3) D a … result(x‘, ¡Music, ¡g‘) pupil ¡ (x‘, ¡sn‘, ¡Voc) … 4. Query the available database “Pupils at vocational schools that took Music“ Q(D a ) ¡= ¡{x'} ¡ ¡ ¡ ¡ à ¡ ¡ ¡x' ¡ is also in Q(D a ) Conclusion: Query Q is complete given the table completeness statements 19 Completeness of Queries over SQL Databases 31.10.2012

  20. Reasoning summary Is that unique? Assume, Q returns a generic answer x‘ over D i 1. See which facts must be in D i 2. Use table completeness to derive facts in D a 3. Evaluate Q( D a ) 4. How to evaluate If x‘ is returned, the query is complete over databases 5. with NULLs? Reasoning is NP-complete for DBs without NULLs [Razniewski/Nutt VLDB 2011] 20 Completeness of Queries over SQL Databases 31.10.2012

  21. What is the Meaning of NULL? result(Paul, ¡Pottery, ¡NULL) } No grades were given in the Pottery course? Non-existing value } Paul received a grade, but the grade was not recorded? Unknown value } It is unknown, which of the two is the case? Ambiguous NULL à NULLs may indicate incomplete information , but need not à Usage of NULLs is ambiguous 21 Completeness of Queries over SQL Databases 31.10.2012

  22. Reasoning over databases w/ NULLs ¡ ¡ ¡ ¡ ¡Q pupils (x):-­‑result(x, ¡Music, ¡A), ¡pupil(x, ¡sn, ¡Voc) “Pupils at vocational schools with A in Music“ 1. Assume Q pupils ¡ returns x‘ over D i 2. See which facts must be in D i result(x‘, ¡Music, ¡ A ) ¡ pupil(x‘, ¡sn‘ ¡,Voc) ¡ result(x‘, ¡Music, ¡ A ) ¡ pupil(x‘, ¡??, ¡Voc) ¡ result(x‘, ¡Music, ¡ A ) ¡ pupil(x‘, ¡NULL, ¡Voc) ¡ 22 Completeness of Queries over SQL Databases 31.10.2012

  23. Challenge 1: How can we adapt the reasoning to NULLs? } In general, the reasoning has to be done for both cases à Reasoning is in Π P 2 } If NULLs stand only for unknown values, then no NULLs can appear in D i and therefore the second case cannot apply à Reasoning is NP-complete 23 Completeness of Queries over SQL Databases 31.10.2012

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend