1 / 178

Temple University – CIS Dept. CIS661 – Principles of Data Management

Temple University – CIS Dept. CIS661 – Principles of Data Management. V. Megalooikonomou Spatial Access Methods (SAMs) (based on slides C. Faloutsos at CMU ). General Overview. Advanced topics Distributed Databases Spatial Access Methods (SAMs) Multimedia Indexing Authorization / Stat. DB.

raltamirano
Download Presentation

Temple University – CIS Dept. CIS661 – Principles of Data Management

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. Temple University – CIS Dept.CIS661 – Principles of Data Management V. Megalooikonomou Spatial Access Methods (SAMs) (based on slides C. Faloutsos at CMU )

  2. General Overview • Advanced topics • Distributed Databases • Spatial Access Methods (SAMs) • Multimedia Indexing • Authorization / Stat. DB

  3. SAMs - Detailed outline • spatial access methods • problem dfn • z-ordering • R-trees

  4. Spatial Access Methods - problem • Given a collection of geometric objects (points, lines, polygons, ...) • organize them on disk, to answer spatial queries (like??)

  5. Spatial Access Methods - problem • Given a collection of geometric objects (points, lines, polygons, ...) • organize them on disk, to answer • point queries • range queries • k-nn queries • spatial joins (‘all pairs’ queries)

  6. Spatial Access Methods - problem • Given a collection of geometric objects (points, lines, polygons, ...) • organize them on disk, to answer • point queries • range queries • k-nn queries • spatial joins (‘all pairs’ queries)

  7. Spatial Access Methods - problem • Given a collection of geometric objects (points, lines, polygons, ...) • organize them on disk, to answer • point queries • range queries • k-nn queries • spatial joins (‘all pairs’ queries)

  8. Spatial Access Methods - problem • Given a collection of geometric objects (points, lines, polygons, ...) • organize them on disk, to answer • point queries • range queries • k-nn queries • spatial joins (‘all pairs’ queries)

  9. Spatial Access Methods - problem • Given a collection of geometric objects (points, lines, polygons, ...) • organize them on disk, to answer • point queries • range queries • k-nn queries • spatial joins (‘all pairs’ within ε)

  10. SAMs - motivation • Q: applications?

  11. SAMs - motivation traditional DB GIS age salary

  12. SAMs - motivation traditional DB GIS age salary

  13. SAMs - motivation CAD/CAM find elements too close to each other

  14. SAMs - motivation CAD/CAM

  15. SAMs - motivation eg,. std S1 F(S1) 1 365 day F(Sn) Sn eg, avg 1 365 day

  16. SAMs - Detailed outline • spatial access methods • problem dfn • z-ordering • R-trees

  17. SAMs: solutions • z-ordering • R-trees • (grid files) Q: how would you organize, e.g., n-dim points, on disk? (C points per disk page)

  18. z-ordering Q: how would you organize, e.g., n-dim points, on disk? (C points per disk page) Hint: reduce the problem to 1-d points(!!) Q1: why? A: Q2: how?

  19. z-ordering Q: how would you organize, e.g., n-dim points, on disk? (C points per disk page) Hint: reduce the problem to 1-d points (!!) Q1: why? A: B-trees! Q2: how?

  20. z-ordering Q2: how? A: assume finite granularity; z-ordering = bit-shuffling = N-trees = Morton keys = geo-coding = ...

  21. z-ordering Q2: how? A: assume finite granularity (e.g., 232x232 ; 4x4 here) Q2.1: how to map n-d cells to 1-d cells?

  22. z-ordering Q2.1: how to map n-d cells to 1-d cells?

  23. z-ordering Q2.1: how to map n-d cells to 1-d cells? A: row-wise Q: is it good?

  24. z-ordering Q: is it good? A: great for ‘x’ axis; bad for ‘y’ axis

  25. z-ordering Q: How about the ‘snake’ curve?

  26. z-ordering Q: How about the ‘snake’ curve? A: still problems: 2^32 2^32

  27. z-ordering Q: Why are those curves ‘bad’? A: no distance preservation (~ clustering) Q: solution? 2^32 2^32

  28. z-ordering Q: solution? (w/ good clustering, and easy to compute, for 2-d and n-d?)

  29. z-ordering Q: solution? (w/ good clustering, and easy to compute, for 2-d and n-d?) A: z-ordering/bit-shuffling/linear-quadtrees • ‘looks’ better: • few long jumps; • scoops out the whole quadrant • before leaving it • a.k.a. space filling curves

  30. z-ordering z-ordering/bit-shuffling/linear-quadtrees Q: How to generate this curve (z = f(x,y) )? A: 3 (equivalent) answers!

  31. z-ordering z-ordering/bit-shuffling/linear-quadtrees Q: How to generate this curve (z = f(x,y))? A1: ‘z’ (or ‘N’) shapes, RECURSIVELY order-2 order-1 ... order (n+1)

  32. ... order (n+1) z-ordering Notice: • self similar (we’ll see about fractals, soon) • method is hard to use: z =? f(x,y) order-2 order-1

  33. z-ordering z-ordering/bit-shuffling/linear-quadtrees Q: How to generate this curve (z = f(x,y) )? A: 3 (equivalent) answers! Method #2?

  34. y 1 1 x 0 0 z =( 0 1 0 1 )2 = 5 z-ordering bit-shuffling y 11 10 01 00 00 10 x 01 11

  35. y 1 1 x 0 0 z =( 0 1 0 1 )2 = 5 z-ordering bit-shuffling y 11 10 01 00 How about the reverse: (x,y) = g(z) ? 00 10 x 01 11

  36. y 1 1 x 0 0 z =( 0 1 0 1 )2 = 5 z-ordering bit-shuffling y 11 10 01 00 How about n-d spaces? 00 10 x 01 11

  37. z-ordering z-ordering/bit-shuffling/linear-quadtrees Q: How to generate this curve (z = f(x,y) )? A: 3 (equivalent) answers! Method #3?

  38. 01... 11... 00... 10... z-ordering linear-quadtrees : assign N->1, S->0 e.t.c. W E 1 N S 0 0 1

  39. 01... 11... 00... 10... z-ordering ... and repeat recursively. Eg.: zblue-cell = WN;WN = (0101)2 = 5 W E 11 00 1 N S 0 0 1

  40. z-ordering Drill: z-value of magenta cell, with the three methods? W E 1 N S 0 0 1

  41. z-ordering Drill: z-value of magenta cell, with the three methods? W E method#1: 14 method#2: shuffle(11;10)= (1110)2 = 14 1 N S 0 0 1

  42. z-ordering Drill: z-value of magenta cell, with the three methods? W E method#1: 14 method#2: shuffle(11;10)= (1110)2 = 14 method#3: EN;ES = ... = 14 1 N S 0 0 1

  43. z-ordering - Detailed outline • spatial access methods • z-ordering • main idea - 3 methods • use w/ B-trees; algorithms (range, knn queries ...) • non-point (eg., region) data • analysis; variations • R-trees

  44. z-ordering - usage & algo’s Q1: How to store on disk? A: Q2: How to answer range queries etc

  45. z-ordering - usage & algo’s Q1: How to store on disk? A: treat z-value as primary key; feed to B-tree PGH SF

  46. PGH SF z-ordering - usage & algo’s MAJOR ADVANTAGES w/ B-tree: • already inside commercial systems (no coding /debugging!) • concurrency & recovery is ready

  47. z-ordering - usage & algo’s Q2: queries? (eg.: find city at (0,3) )? PGH SF

  48. z-ordering - usage & algo’s Q2: queries? (eg.: find city at (0,3) )? A: find z-value; search B-tree PGH SF

  49. z-ordering - usage & algo’s Q2: range queries? PGH SF

  50. z-ordering - usage & algo’s Q2: range queries? A: compute ranges of z-values; use B-tree PGH 9,11-15 SF

More Related