300 likes | 437 Views
A Semantic Caching Method Based on Linear Constraints. Yoshiharu Ishikawa and Hiroyuki Kitagawa University of Tsukuba {ishikawa,kitagawa}@is.tsukuba.ac.jp. Outline. Background Data caching Semantic caching Our Approach Algorithms Future work and conclusion. Data Caching (1).
E N D
A Semantic Caching MethodBased on Linear Constraints Yoshiharu Ishikawa and Hiroyuki Kitagawa University of Tsukuba {ishikawa,kitagawa}@is.tsukuba.ac.jp
Outline • Background • Data caching • Semantic caching • Our Approach • Algorithms • Future work and conclusion
Data Caching (1) • Stores a query result intolocal cache • Uses cached results for later queries: improves response time • Based on the notion oftemporal locality • Used in various situations: • Client-server database environments • Data warehousing • has relationship with materialized view
Data Caching (2) Query Result Server DBMS Query Client Module Result Result Database Local Cache
Data Caching (3) Query Result Examination Reminder Query Server DBMS Client Module Result Probe Query Cache Information Result Database Local Cache
Semantic Caching (1) • Based onsemantic locality(in addition to temporal locality) • Similar objects tend to be referenced together • Related work • Semantic caching based onrectlinear region(Dar, Franklin, Srivastava et al.) • Predicate caching (Keller and Basu) • View caching (Roussopoulos et al.)
Semantic Caching (2) • Semantic caching based onrectlinear region Q1: SELECT * FROM Employee WHERE age 30 AND age 40 AND salary 2000 AND salary 3000 salary 4000 3000 Q2: SELECT * FROM Employee WHERE age 35 AND age 50 AND salary 2500 AND salary 4000 2000 30 40 50 age stored into local cache
Semantic Caching (2) • Semantic caching based onrectlinear region Q1: SELECT * FROM Employee WHERE age 30 AND age 40 AND salary 2000 AND salary 3000 salary reminder query 4000 3000 Q2: SELECT * FROM Employee WHERE age 35 AND age 50 AND salary 2500 AND salary 4000 probe query 2000 30 40 50 age
Semantic Caching (3) Probe Query SELECT * FROM Employee WHERE age 35 AND age 40 AND salary 2500 AND salary 3000 salary reminder query 4000 Reminder Query SELECT * FROM Employee WHERE (age 35 AND age 40 AND salary 3000 AND salary 4000) OR (age 40 AND age 50 AND salary 2500 AND salary 4000) OR (age 40 AND age 50 AND salary 3000 AND salary 4000) 3000 probe query 2000 30 40 50 age
Outline • Background • Our Approach • An example • Constraint data model • Algorithms • Future work and conclusion
Our Approach • A new approach to semantic caching • Generalization of rectlinear region-based approach • Based onlinear constraints • Assumption: a query condition is aconjunctionof (in)equality formulas • Caches retrievedbase tuples • Maintains compactconstraint relationsto describe cached base tuples
An Example (1) client retieves all base tuples which satisfy q1 Q1 SELECT name, year FROM UsedCar WHERE displacement 1500 AND price 8000 q1 (displacement 1500) (price 8000)
An Example (1) client retieves all base tuples which satisfy q1 Q1 SELECT name, year FROM UsedCar WHERE displacement 1500 AND price 8000 q1 (displacement 1500) (price 8000) client stores a tuple incache-info to describe obtained tuples cache-info
An Example (2) Q2 SELECT name, price, tax FROM UsedCar WHERE displacement 1200 AND price + tax 10000 q2 (displacement 1200) (price + tax 10000) client examinescache-info to check the availability of tuples cache-info
An Example (3) Probe Query q1q2= ((displacement 1500) (price 8000)) ((displacement 1200) (price + tax 10000)) = (displacement 1500) (price 8000) (price + tax 10000) tax 8000 price
An Example (3) Probe Query q1q2= ((displacement 1500) (price 8000)) ((displacement 1200) (price + tax 10000)) = (displacement 1500) (price 8000) (price + tax 10000) tax 10000 8000 10000 price
An Example (3) Probe Query q1q2= ((displacement 1500) (price 8000)) ((displacement 1200) (price + tax 10000)) = (displacement 1500) (price 8000) (price + tax 10000) tax 10000 semantic region for the probe query 8000 10000 price
An Example (4) Probe Query q1q2= (displacement 1500) (price 8000) (price + tax 10000) Reminder Query q1q2= ((displacement < 1500) (price > 8000)) ((displacement 1200) (price + tax 10000)) cache-info
Constraint Data Model • Incorporates the notion ofconstraintsdirectly into the data model • Can representinfinite informationin terms of finite representation • A constraint data model is a combination of • Base data model: relational data model, datalog, etc. • Constraint domain: dense order, linear arithmetic, polynomials, etc.
Definition of the Data Model • Constraint k-tuple = 1...N • i: constraint (equality or inequality constraint) • In our case, linear constraints are used • Linear constrainta1x1 + ... + apxp a0 • ai: integer • {=, , <, , >, } • Constraint relationr = {1, ..., M} • i : constraint k-tuple • Also represented as r = 1 ... M(disjunctive normal form)
Orthographic Partitioning • Proposed by Grumbach et al. • Partitions a constraint tuple into independent components • Reduces computational complexity
Outline • Background • Our Approach • Algorithms • Cache examination • Overlap computation • Cache replacement • Future work and conclusion
Cache Examination Algorithm • Checks the availability of cached base tuples • Generates a probe query and a reminder query • Takes orthographic partitioning into consideration t2 t1 q
Cache Examination Algorithm(1) probe query • Checks the availability of cached base tuples • Generates a probe query and a reminder query • Takes orthographic partitioning into consideration t2 reminder query t1 q
Cache Examination Algorithm(2) • The brief idea • For each tuple i in cache-info, compute pqi, its overlap with query q • The probe query is generated aspq := pq1... pqn • The reminder query is generated as rq := qpq
Overlap Computation • Requirement: delete redundant constraints from the overlap • e.g. (age > 30) (age 50) (age > 40) (age > 40) (age 50) • For this purpose, we applied a technique found in linear programming • Calculate all of thebasic feasible solutionsfrom the given constraints • If a solution does not exist, there is no overlap. • Resulting constraint is easily calculated
Cache Replacement • A simple reference count-based algorithm • Sets a counter for each base tuple • If cache is full, it uses select-victim() function to select victims for the replacement (definition of the select-victim function is the future work). • If a reference counter becomes 0, its corresponding base tuple is deleted from the cache.
Outline • Background • Our Approach • Algorithms • Cache examination • Overlap computation • Cache replacement • Future work and conclusion
Future Work • Efficient calculation of overlaps • Use of indexes • Minimum bounding box (MBB)-based approach • Cache Replacement algorithm • Efficient replacement algorithm • Simulation-based Evaluation
Conclusion • A new approach to semantic caching • linear constraint-based approach • A naive algorithm to compute a probe query and a reminder query • Overlap computation is the key factor • An overlap computation algorithm based on linear programming • Proposal of replacement algorithm