Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

TINTIN Demo

698 views

Published on

A demo of the tool TINTIN, a Tool for INcremental INTegrity checking of SQL assertions in SQLServer.
More info in http://www.essi.upc.edu/~xoriol/tintin/

Published in: Engineering
  • Be the first to comment

  • Be the first to like this

TINTIN Demo

  1. 1. TINTIN TINTIN A Tool for INcremental INTegrity checking of SQL assertions in SQLServer Xavier Oriol Universitat Politècnica de Catalunya Ernest Teniente Universitat Politècnica de Catalunya Guillem Rull Universitat de Barcelona
  2. 2. TINTIN 2 Schema Motivating Example name: String Person *1..* FamousDirector * Directs Wins Consider the constraint: Any famous director has directed some award-winning movie Steven Spielberg Jurassic Park (I) Visual Effects directed won title: String releasedYear: Integer Movie name: String Award *
  3. 3. TINTIN 3 How can we check this constraint? Running a query looking for the violations Select * from FamousDirector as FD where not exists (Select * from Directs as D join Wins as W on (D.movie_id = W.movie_id) where D.person_id = FD.id) Writing a query returning any famous director who has not directed an award-winning movie. Empty query = constraint satisfaction Problem: bad performance Running the query = checking all the data If we delete ‘Jurassic Park’ from DB, and run the query, it will search for award-winning movies for all famous directors... … but the unique relevant one to check is Spielberg!
  4. 4. TINTIN 4 How can we check this constraint? Manually programming an efficient solution is difficult Deleting an award-winning movie from DB causes a violation… … unless in the DB there is another award-winning movie directed by the same director… … or there is an insertion of a new movie … … or the director is being deleted as a famous director … which should be award-winning and by the same director… … such that it is not being deleted in the same transaction too… Manual programming = Are you sure you are taking in account all cases?
  5. 5. TINTIN 5 We need an automatic method for Checking only those parts of the data that might violate our defined constraints taking in account the update being applied In other words, we need an Incremental method for consistency checking This is exactly what we provide with TINTIN
  6. 6. TINTIN 6 TINTIN – A Quick DEMO 1. Connect TINTIN to your DB
  7. 7. TINTIN 7 del_DIRECTS person_id movie_id 1 1 What has happened? TINTIN now automatically captures all the insertions/deletions the user wants to apply delete from directs where movie_id = 1 insert into movie values (2, ‘War Horse’, 2012) The update is not applied, but the tuples the user wants to insert/delete are internally stored in auxiliary SQL tables If a user sends ins_MOVIE Id Title Year 2 War Horse 2012 Current table Auxiliary tables DIRECTS person_id movie_id 1 1
  8. 8. TINTIN 8 TINTIN – A Quick DEMO 1. Connect TINTIN to your DB 2. Write your assertions into TINTIN
  9. 9. TINTIN 9 FamousDirector Id Name 1 Steven Spielberg ins_MOVIE Id Title Year 2 War Horse 2012 What has happened? The safeCommit() procedure has been created. This procedure looks for ins/deletions of tuples violating your defined assertion/s The safeCommit procedure inspects the auxiliary tables storing the modifications to be applied. If it finds an insertion/deletion causing a violation, the updates are discarded, otherwise, they are committed del_DIRECTS movie_id person_id 1 1 This is going to violate our assertion!
  10. 10. TINTIN 10 TINTIN – A Quick DEMO 1. Connect TINTIN to your DB 2. Write your assertions into TINTIN 3. Use your DB normally. Just recall to call safeCommit() at the end of your transactions
  11. 11. TINTIN 11 TINTIN – A Quick DEMO delete from directs where movie_id = 1; insert into movie values (2, ‘War Horse’, 2012); insert into directs values(1, 2) safeCommit() delete from directs where movie_id = 1; insert into movie values (2, ‘War Horse’, 2012); insert into directs values(1, 2) insert into wins(2, 1) safeCommit() 1 violation was found. The update is rejected. No violations were found. The update is commited. Two simple use case examples:
  12. 12. TINTIN 12 Scalability experiment We have used the TPC-H benchmark, a benchmark for illustrating decision support systems that examine large volumes of data. - Current data = 1GB * SF - Data updates = 1MB * SF *Nim = Non Incremental Approach
  13. 13. TINTIN 13 How does it work? It works with a logical based core SQL is translated into Logic Denials, Logic Denials into Event Dependency Constraints Event Dependency Constraints into SQL
  14. 14. TINTIN 14 Logical based core famousDirector(x) ^ ¬directsAwardMovie(x) → ⏊ directsAwardMovie(x) ← directs(x, y) ^ wins(y, z) PN(x) = P(x) ^ ¬del_P(x) v ins_P(x) A tuple P exists in the new state N if it exists and it is not being deleted, or if it is being inserted ¬PN(x) = ¬P(x) ^ ¬ins_P(x) v del_P(x) ins_famousDirector(x) ^ del_directsAwardMovie(x) → ⏊ famousDirector(x) ^ ¬del_famousDirector(x)) ^ del_directsAwardMovie(x) → ⏊ del_directsAwardMovie(x) ← del_directs(x, y) ^ wins(y, z) ^ ¬directsAwardMovieN (x) del_directsAwardMovie(x) ← directs(x, y) ^ del_wins(y, z) ^ ¬directsAwardMovieN (x) … SQL Logic Denials Event Dependency Constraints
  15. 15. TINTIN 15 What does it support? It supports any relational algebra constraint What do we plan to support in the future? SQL distributive aggregates & arithmetic functions

×