Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.



Published on

This session will help you write your first queries using InfluxQL. Katy will then share best practices to help make your queries efficient and fast.

Published in: Internet
  • Be the first to comment

  • Be the first to like this


  1. 1. Agenda: New Practitioners Track WORKSHOPAGENDA
  2. 2. Writing Queries Katy Farmer
  3. 3. Agenda • Writing queries using InfluxQL • Optimizing InfluxQL • Writing TICKscript
  4. 4. © 2018 InfluxData. All rights reserved.5 The InfluxDB Query Language (InfluxQL) is a SQL-like query language tailored for querying ranges of time. InfluxQL SELECT <field_key>[,<field_key>,<tag_key>] FROM <measurement_name>[,<measurement_name>] Example: SELECT "usage_user" FROM “cpu"
  5. 5. © 2018 InfluxData. All rights reserved.6 Tips for performant queries: • Single queries are more expensive than batches • Convert continuous queries to Kapacitor tasks • Persist highly dynamic values as fields, and restrict tags for GROUP BY and InfluxQL functions – memory usage grows w/cardinality • Schema on write still calls for schema design Optimization
  6. 6. © 2018 InfluxData. All rights reserved.7 DSL used to define tasks (stream or batch) for processing data in Kapacitor. TICKscript stream // Select just the cpu measurement from our example database. |from() .measurement('cpu') |alert() .crit(lambda: int("usage_idle") < 90) // Whenever we get an alert write it to a file. .log('/tmp/alerts.log')
  7. 7. © 2018 InfluxData. All rights reserved.8 Reading and Writing Data with the API • Create a new database using the API • Write data to “mydb” curl -i -XPOST http://localhost:8086/query --data-urlencode "q=CREATE DATABASE mydb" curl -i -XPOST 'http://localhost:8086/write?db=mydb' --data-binary 'cpu_load_short,host=server01,region=us-west value=0.64 1434055562000000000' measurement tag field timestamp
  8. 8. Thank You