Presentation is loading. Please wait.

Presentation is loading. Please wait.

W. Hong & S. Madden – Implementation and Research Issues in Query Processing for Wireless Sensor Networks, ICDE 2004.

Similar presentations


Presentation on theme: "W. Hong & S. Madden – Implementation and Research Issues in Query Processing for Wireless Sensor Networks, ICDE 2004."— Presentation transcript:

1 W. Hong & S. Madden – Implementation and Research Issues in Query Processing for Wireless Sensor Networks, ICDE 2004

2 Outline Introduction I I Architecture II Data Model and Query Language III Query Dissemination and Result Collection IV Query Processing V V Conclusions VI

3 Outline Introduction I I Architecture II Data Model and Query Language III Query Dissemination and Result Collection IV Query Processing V V Conclusions VI

4 4 Introduction – Sensor Database SELECT MAX(mag) FROM sensors WHERE mag > thresh SAMPLE PERIOD 64ms High level abstraction: – Data centric programming – Interact with sensor network as a whole – Extensible framework Under the hood: – Intelligent query processing: query optimization, power efficient execution – Fault Mitigation: automatically introduce redundancy, avoid problem areas App Sensor Network Query Processor Query, Trigger Data

5 5 Architecture - overall TinyDB GUI TinyDB Client API DBMS Sensor network TinyDB query processor 0 4 0 1 5 2 6 3 7 JDBC Mote side PC side 8

6 6 Architecture - mote TinyDB Distributed in Network Query processor Query reception Query processing Runtime Adaptation Catalog TinyOS sampling, communication Root (gateway node) Wireless Sensor networks

7 7 Architecture - server Client PC-Base station DataQuery Query parsing Query optimization Query result storage and display Routing Tree

8 Outline Introduction I I Architecture II Data Model and Query Language III Query Dissemination and Result Collection IV Query Processing V V Conclusions VI

9 9 Data Model Entire sensor network as one single, infinitely-long logical table: sensors Columns consist of all the attributes defined in the network Typical attributes: – Sensor readings – Meta-data: node id, location, etc. – Internal states: routing tree parent, time-stamps, queue length, etc. Nodes return NULL for unknown attributes On server, all attributes are defined in catalog.xml

10 10 Query Language - TinySQL SELECT, [FROM {sensors | }] [WHERE ] [GROUP BY ] [HAVING ] [SAMPLE PERIOD | ONCE] [INTO ]

11 11 Comparison with SQL Single table in FROM clause No sub-queries No column alias in SELECT clause Only fundamental difference: SAMPLE PERIOD clause The result of query is a stream of values (rather than single aggregate value)

12 12 TinySQL Example SELECT nodeid, nestNo, light FROM sensors WHERE light > 400 SAMPLE PRIOD 1s FOR 2s 2 1 2 1 nodeid 405251 422171 389250 455170 lightnestNoEpoch Sensors “Find the sensors in bright nests.”

13 13 Event-based Queries ON event SELECT … Run query only when interesting events happen Event examples - Button pushed - Message arrival - Bird enters nest Analogous to triggers but events are user-defined

14 14 Query over Stored Data Named buffers in Flash memory Store query results in buffers Query over named buffers Analogous to materialized views Example: - CREATE BUFFER name SIZE x (field1 type1, field2 type2, …) - SELECT a1, a2 FROM sensors SAMPLE PERIOD d INTO name - SELECT field1, field2, … FROM name SAMPLE PERIOD d

15 Outline Introduction I I Architecture II Data Model and Query Language III Query Dissemination and Result Collection IV Query Processing V V Conclusions VI

16 16 Tree-based Routing Tree-based routing - Used in: –Query delivery –Data collection –In-network aggregation A B C D F E Q:SELECT … Q Q Q Q Q Q Q Q Q QQ Q R:{…}

17 17 Basic Aggregation In each epoch: - Each node samples local sensors once - Generates partial state record (PSR) –local readings –readings from children - Outputs PSR during assigned comm. interval At end of epoch, PSR for whole network output at root New result on each successive epoch 1 23 4 5

18 18 Illustration: Aggregation 1 2 3 14 4 54321 1 2 3 4 5 1 Sensor # Interval # Interval 4 SELECT COUNT(*) FROM sensors Epoch

19 19 Illustration: Aggregation 1 2 23 14 4 54321 1 2 3 4 5 2 Sensor # Interval 3 SELECT COUNT(*) FROM sensors Interval #

20 20 Illustration: Aggregation 1 312 23 14 4 54321 1 2 3 4 5 3 1 Sensor # Interval 2 SELECT COUNT(*) FROM sensors Interval #

21 21 Illustration: Aggregation 51 312 23 14 4 54321 1 2 3 4 5 5 Sensor # Interval 1 Interval # SELECT COUNT(*) FROM sensors

22 22 Illustration: Aggregation 51 312 23 14 14 54321 1 2 3 4 5 1 Sensor # SELECT COUNT(*) FROM sensors Interval 4 Interval #

23 Outline Introduction I I Architecture II Data Model and Query Language III Query Dissemination and Result Collection IV Query Processing V V Conclusions VI

24 24 Inside TinyDB TinyOS Schema Query Processor Multihop Network Filter light > 400 get (‘temp’) Agg avg(temp) Queries SELECT AVG(temp) WHERE light > 400 Results T:1, AVG: 225 T:2, AVG: 250 Tables Samples got(‘temp’) Name: temp Time to sample: 50 uS Cost to sample: 90 uJ Calibration Table: 3 Units: Deg. F Error: ± 5 Deg F Get f : getTempFunc() … getTempFunc(…)TinyDB

25 25 Acquisitional Query Processing (ACQP) TinyDB acquires AND processes data - Could generate an infinite number of samples An acqusitional query processor controls - when, - where, - and with what frequency data is collected! Versus traditional systems where data is provided a priori

26 26 ACQP: What’s Different? How should the query be processed? - Sampling as a first class operation How does the user control acquisition? - Rates or lifetimes - Event-based triggers Which nodes have relevant data? - Index-like data structures Which samples should be transmitted? - Prioritization, summary, and rate control

27 27 E(sampling mag) >> E(sampling light) 1500 uJ vs. 90 uJ Operator Ordering: Interleave Sampling + Selection SELECT light, mag FROM sensors WHERE pred1(mag) AND pred2(light) SAMPLE PERIOD 1s  (pred1)  (pred2) mag light Traditional DBMS At 1 sample / sec, total power savings could be as much as 3.5mW  Comparable to processor!  (pred1)  (pred2) mag light  (pred1)  (pred2) mag light ACQP Correct ordering (unless pred1 is very selective and pred2 is not): Cheap Costly

28 28 Conclusions Architecture Data Model and Query Language Query Dissemination and Result Collection Query Processing

29 Questions ?


Download ppt "W. Hong & S. Madden – Implementation and Research Issues in Query Processing for Wireless Sensor Networks, ICDE 2004."

Similar presentations


Ads by Google