Meta-SQL: Towards practical meta-querying Jan Van den Bussche Stijn Vansummeren Limburgs...
-
Upload
arline-franklin -
Category
Documents
-
view
214 -
download
1
Transcript of Meta-SQL: Towards practical meta-querying Jan Van den Bussche Stijn Vansummeren Limburgs...
![Page 1: Meta-SQL: Towards practical meta-querying Jan Van den Bussche Stijn Vansummeren Limburgs Universitair Centrum Gottfried Vossen University of Muenster.](https://reader036.fdocuments.net/reader036/viewer/2022083005/56649f255503460f94c3bbcf/html5/thumbnails/1.jpg)
Meta-SQL: Towards practical meta-querying
Jan Van den BusscheStijn Vansummeren
Limburgs Universitair Centrum
Gottfried Vossen
University of Muenster
![Page 2: Meta-SQL: Towards practical meta-querying Jan Van den Bussche Stijn Vansummeren Limburgs Universitair Centrum Gottfried Vossen University of Muenster.](https://reader036.fdocuments.net/reader036/viewer/2022083005/56649f255503460f94c3bbcf/html5/thumbnails/2.jpg)
Context
Enterprise databases contain not only data but also queries:
• view definitions• stored procedures• usage logs• workloads• software engineering
Stored as long strings… Difficult to query in standard SQL
![Page 3: Meta-SQL: Towards practical meta-querying Jan Van den Bussche Stijn Vansummeren Limburgs Universitair Centrum Gottfried Vossen University of Muenster.](https://reader036.fdocuments.net/reader036/viewer/2022083005/56649f255503460f94c3bbcf/html5/thumbnails/3.jpg)
Goal
Allow meta-querying: query the stored queries together with ordinary data
• Which queries do the most joins?• Which queries return an empty answer?• What are common subexpressions in this workload?• If I do these updates, which materialized views change their value?
![Page 4: Meta-SQL: Towards practical meta-querying Jan Van den Bussche Stijn Vansummeren Limburgs Universitair Centrum Gottfried Vossen University of Muenster.](https://reader036.fdocuments.net/reader036/viewer/2022083005/56649f255503460f94c3bbcf/html5/thumbnails/4.jpg)
Contribution
Meta-SQL: conservative extension of SQL to allow meta-querying
• store queries in XML• call XSLT within SQL• add XML-variables• add an EVAL function
Works on top of any SQL99-compliant DBMS
Prototype with DB2 UDB
![Page 5: Meta-SQL: Towards practical meta-querying Jan Van den Bussche Stijn Vansummeren Limburgs Universitair Centrum Gottfried Vossen University of Muenster.](https://reader036.fdocuments.net/reader036/viewer/2022083005/56649f255503460f94c3bbcf/html5/thumbnails/5.jpg)
Call XSLT within SQL
Which queries do the most joins?
select name from Views where count_tables(def) =(select max( ( )) from Views)
written in XSLT view definition in XML
count_tables def
![Page 6: Meta-SQL: Towards practical meta-querying Jan Van den Bussche Stijn Vansummeren Limburgs Universitair Centrum Gottfried Vossen University of Muenster.](https://reader036.fdocuments.net/reader036/viewer/2022083005/56649f255503460f94c3bbcf/html5/thumbnails/6.jpg)
XML-variables
select s from Views, s in def[ ]group by shaving count(name)>=2
s ranges over all query-subelements of stored query
arbitrary Xpath-expression
//query
What are the common subqueries?
![Page 7: Meta-SQL: Towards practical meta-querying Jan Van den Bussche Stijn Vansummeren Limburgs Universitair Centrum Gottfried Vossen University of Muenster.](https://reader036.fdocuments.net/reader036/viewer/2022083005/56649f255503460f94c3bbcf/html5/thumbnails/7.jpg)
EVAL function
select name from Views where not exists(select * from EVAL(def))
Which queries return an empty answer?
EVAL produces query results in SQL row variableUEVAL produces them in XML-variable
![Page 8: Meta-SQL: Towards practical meta-querying Jan Van den Bussche Stijn Vansummeren Limburgs Universitair Centrum Gottfried Vossen University of Muenster.](https://reader036.fdocuments.net/reader036/viewer/2022083005/56649f255503460f94c3bbcf/html5/thumbnails/8.jpg)
Implementation
XSLT functions Meta-SQL query
Java wrappersSQL statements(CREATE FUNCTION)
Rewriting in SQL99
SAXON (XML processing) Extract (XML variables)EVAL
compilation
execution