a semantic caching method based on linear constraints

30
A Semantic Caching Method Based on Linear Constraints Yoshiharu Ishikawa and Hiroyuki Kitagawa University of Tsukuba {ishikawa,kitagawa}@is.tsukuba .ac.jp

Upload: barton

Post on 22-Feb-2016

43 views

Category:

Documents


0 download

DESCRIPTION

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). - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: A Semantic Caching Method Based on Linear Constraints

A Semantic Caching MethodBased on Linear Constraints

Yoshiharu Ishikawa and Hiroyuki Kitagawa University of Tsukuba

{ishikawa,kitagawa}@is.tsukuba.ac.jp

Page 2: A Semantic Caching Method Based on Linear Constraints

Outline

Background– Data caching– Semantic caching

Our Approach Algorithms Future work and conclusion

Page 3: A Semantic Caching Method Based on Linear Constraints

Data Caching (1) Stores a query result into local cache Uses cached results for later queries: improves

response time Based on the notion of temporal locality Used in various situations:

– Client-server database environments– Data warehousing– has relationship with materialized view

Page 4: A Semantic Caching Method Based on Linear Constraints

Data Caching (2)

Database

ServerDBMS

ClientModule

Query

Query

Result

Result

Result

LocalCache

Page 5: A Semantic Caching Method Based on Linear Constraints

Data Caching (3)

Database

ServerDBMS

ClientModule

Query

ReminderQuery

Result

Result

LocalCache

CacheInformation

Examination

ProbeQueryResult

Page 6: A Semantic Caching Method Based on Linear Constraints

Semantic Caching (1)

Based on semantic locality (in addition to temporal locality)– Similar objects tend to be referenced together

Related work– Semantic caching based on rectlinear region (D

ar, Franklin, Srivastava et al.)– Predicate caching (Keller and Basu)– View caching (Roussopoulos et al.)

Page 7: A Semantic Caching Method Based on Linear Constraints

Semantic Caching (2) Semantic caching based on rectlinear region

age

salaryQ1: SELECT *

FROM Employee WHERE age 30 AND age 40 AND salary 2000 AND salary 3000

30 40

3000

2000Q2: SELECT * FROM Employee WHERE age 35 AND age 50 AND salary 2500 AND salary 4000

4000

50stored into local cache

Page 8: A Semantic Caching Method Based on Linear Constraints

Semantic Caching (2) Semantic caching based on rectlinear region

age

salaryQ1: SELECT *

FROM Employee WHERE age 30 AND age 40 AND salary 2000 AND salary 3000

30 40

3000

2000Q2: SELECT * FROM Employee WHERE age 35 AND age 50 AND salary 2500 AND salary 4000

4000

50

probequery

reminderquery

Page 9: A Semantic Caching Method Based on Linear Constraints

Semantic Caching (3)

age

salary

Probe Query SELECT *FROM EmployeeWHERE age 35 AND age 40AND salary 2500 AND salary 3000

30 40

3000

2000

Reminder Query SELECT *FROM EmployeeWHERE (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)

4000

50

probequery

reminderquery

Page 10: A Semantic Caching Method Based on Linear Constraints

Outline

Background Our Approach

– An example– Constraint data model

Algorithms Future work and conclusion

Page 11: A Semantic Caching Method Based on Linear Constraints

Our Approach A new approach to semantic caching

– Generalization of rectlinear region-based approach– Based on linear constraints

Assumption: a query condition is a conjunction of (in)equality formulas

Caches retrieved base tuples Maintains compact constraint relations to

describe cached base tuples

Page 12: A Semantic Caching Method Based on Linear Constraints

An Example (1)

Q1SELECT name, yearFROM UsedCarWHERE displacement 1500 AND price 8000

name maker year displacement price tax …Maxima Nissan 1998 1800 12,000 800 …Mirage Mitsubishi 1997 1200 5,000 250 …J etta Volkswagen 1994 1600 6,000 300 …

… … … … … … …

q1

(displacement 1500) (price 8000)

client retieves all base tuples which satisfy q1

Page 13: A Semantic Caching Method Based on Linear Constraints

An Example (1)

Q1SELECT name, yearFROM UsedCarWHERE displacement 1500 AND price 8000

q1

(displacement 1500) (price 8000)

client retieves all base tuples which satisfy q1

tid constraint tuple time t1 (displacement 1500) (price 8000) T1

cache-info

client stores a tuple in cache-infoto describe obtained tuples

Page 14: A Semantic Caching Method Based on Linear Constraints

An Example (2)

Q2SELECT name, price, taxFROM UsedCarWHERE displacement 1200AND price + tax 10000

q2

(displacement 1200) (price + tax 10000)

tid constraint tuple time t1 (displacement 1500) (price 8000) T1

cache-info

client examines cache-infoto check the availability of tuples

Page 15: A Semantic Caching Method Based on Linear Constraints

An Example (3)Probe Queryq1 q2 = ((displacement 1500) (price 8000)) ((displacement 1200) (price + tax 10000)) = (displacement 1500) (price 8000) (price + tax 10000)

8000price

tax

Page 16: A Semantic Caching Method Based on Linear Constraints

An Example (3)Probe Queryq1 q2 = ((displacement 1500) (price 8000)) ((displacement 1200) (price + tax 10000)) = (displacement 1500) (price 8000) (price + tax 10000)

10000

100008000price

tax

Page 17: A Semantic Caching Method Based on Linear Constraints

An Example (3)Probe Queryq1 q2 = ((displacement 1500) (price 8000)) ((displacement 1200) (price + tax 10000)) = (displacement 1500) (price 8000) (price + tax 10000)

10000

100008000price

tax

semantic region for the probequery

Page 18: A Semantic Caching Method Based on Linear Constraints

An Example (4)Probe Queryq1 q2 = (displacement 1500) (price 8000) (price + tax 10000)

Reminder Queryq1 q2 = ((displacement < 1500) (price > 8000)) ((displacement 1200) (price + tax 10000))

tid constraint tuple time t1 (displacement 1500) (price 8000) T1 t2 (displacement 1200) (price + tax 10000) T2

cache-info

Page 19: A Semantic Caching Method Based on Linear Constraints

Constraint Data Model Incorporates the notion of constraints directly

into the data model Can represent infinite information in 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.

Page 20: A Semantic Caching Method Based on Linear Constraints

Definition of the Data Model Constraint k-tuple = 1 ... N

i: constraint (equality or inequality constraint)– In our case, linear constraints are used

Linear constraint a1x1 + ... + apxp a0

– ai: integer {=, , <, , >, }

Constraint relation r = {1, ..., M} i : constraint k-tuple

– Also represented as r = 1 ... M (disjunctive normal form)

Page 21: A Semantic Caching Method Based on Linear Constraints

Orthographic Partitioning

Proposed by Grumbach et al. Partitions a constraint tuple into

independent components Reduces computational complexity

tid op1 op2 time t1 (displacement 1500) (price 8000) T1 t2 (displacement 1200) (price + tax 10000) T2

tid constraint tuple time t1 (displacement 1500) (price 8000) T1 t2 (displacement 1200) (price + tax 10000) T2

Page 22: A Semantic Caching Method Based on Linear Constraints

Outline Background Our Approach Algorithms

– Cache examination– Overlap computation– Cache replacement

Future work and conclusion

Page 23: A Semantic Caching Method Based on Linear Constraints

Cache Examination Algorithm Checks the availability

of cached base tuples Generates a probe

query and a reminder query

Takes orthographic partitioning into consideration

t1

t2

q

Page 24: A Semantic Caching Method Based on Linear Constraints

Cache Examination Algorithm(1) Checks the availability

of cached base tuples Generates a probe

query and a reminder query

Takes orthographic partitioning into consideration

t1

t2

q

probe query

reminderquery

Page 25: A Semantic Caching Method Based on Linear Constraints

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 as

pq := pq1 ... pqn

– The reminder query is generated as rq := q pq

Page 26: A Semantic Caching Method Based on Linear Constraints

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 the basic feasible solutions from the given

constraints– If a solution does not exist, there is no overlap.– Resulting constraint is easily calculated

Page 27: A Semantic Caching Method Based on Linear Constraints

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.

Page 28: A Semantic Caching Method Based on Linear Constraints

Outline Background Our Approach Algorithms

– Cache examination– Overlap computation– Cache replacement

Future work and conclusion

Page 29: A Semantic Caching Method Based on Linear Constraints

Future Work

Efficient calculation of overlaps– Use of indexes– Minimum bounding box (MBB)-based

approach Cache Replacement algorithm

– Efficient replacement algorithm Simulation-based Evaluation

Page 30: A Semantic Caching Method Based on Linear Constraints

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