1 / 10

SchemaSQL Semantics & Optimization

SchemaSQL Semantics & Optimization. Review SQL semantics : select attrList, aggList from tupleVar declaration list where whereConditions having aggConditions Q: databases  relations (fixed I/O schema.) instantiation-based semantics.

gitano
Télécharger la présentation

SchemaSQL Semantics & Optimization

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SchemaSQL Semantics & Optimization Review SQL semantics: select attrList, aggList from tupleVar declaration list where whereConditions having aggConditions Q: databases  relations (fixed I/O schema.) instantiation-based semantics. i: tuple vars in Q  tuples in D, input db.

  2. i may (not) satisfy whereConditions: valid/invalid instantiations. • tuple-assembly_Q(i) – concatenateall i(t)[A] where “t.A” is in attrList. • one o/p tuple per valid instantiation. • may produce duplicates (multiset semantics). • What if aggList is non-empty? • Partition set of valid instantiations into classes: • i ~ j if they agree on all group-by attributes. • compute aggregate value(s) per block of partition. • Blocks/classes may/may not satisfy havingConditions: valid blocks.

  3. For each valid block e, compute aggregate tuple: concatenate agg[i(t)[B] | i in e], where “agg(t.B)” in aggList. • Then append this aggregate tuple with a tuple over the attrList attributes assembled using any instantiation in e. (why does this work?) • That’s a 1 min. summary of SQL semantics (with simplifications). • Same approach carries over to SchemaSQL.

  4. SchemaSQL semantics • See TODS 2001 paper for technical development. • Key issue: what happens when query/view restructures i/p schema? • Need to determine o/p schema first. • Then allocate data into it, putting each piece in the “right” slot. • Need to consider equiv. relations w.r.t. create view variables in addition to group-by (if any)!

  5. SchamaSQL Query Evaluation Architecture Resident SQL engine Answers to local queries Final series of queries FA Input SchemaSQL Query Final answer SchemaSQL Server Optimized local query Optimized local query DBMS1 DBMSn

  6. Query Processing • Phase I: rewrite conditions into CNF; generate instantiation tables for (groups of) vars declared in from clause. • Transform original SchemaSQL query/view into equivalent SQL one against the natural join of above VITs. • Assumption: all relevant meta-data (and stats) stored in a federation system table (FST). Not unlike DBMS catalog tables!

  7. Query Processing – Example select RelC, C.salFloor from univC RelC, univC::RelC C, univD::salInfo D where RelC = D.dept AND C.salFloor > D.technician AND C.category = “technician”

  8. QP – example: Phase I • Populate VIT_RelC(RelC) via: select rel-name as RelC from FST where db-name = “univC” • Schema of VIT_C? • Include related meta-var: RelC. • Include all relevant attributes/attr vars for C: C.salFloor; no need to include C.technician (why?).

  9. QP – example: Phase I • Populate VIT_C(RelC,CsalFloor) by (against univC): select `r1’ as RelC, salFloor as CsalFloor from r1 where category = “technician” UNION … UNION select `rm’ as RelC, salFloor as CsalFloor from rm where category = “technician” where {r1, …, rm} are the bindings for RelC from VIT_RelC.

  10. QP – example: Phase I & II • Populate VIT_D(Ddept, Dtechnician) by (against univD): select dept as Ddept, technician as Dtechnician fromsalFloor why did we include Ddept? • Phase II: Join VIT_RelC(RelC), VIT_C(RelC, CsalFloor), and VIT_D(Ddept, Dtechnician) and impose CsalFloor > Dtechnician. • how does this work? • Other cases: aggregation, dynamic o/p schema, etc. – see paper.

More Related