Slide 1

Slide 1 text

Not everything is a damn SQL statement By Thijs Feryn

Slide 2

Slide 2 text

Hi, I’m Thijs

Slide 3

Slide 3 text

I’m @ThijsFeryn on Twitter

Slide 4

Slide 4 text

I’m an at Evangelist

Slide 5

Slide 5 text

I’m a at board member

Slide 6

Slide 6 text

Big Data

Slide 7

Slide 7 text

I’m NOT an expert

Slide 8

Slide 8 text

But I see some typical problems

Slide 9

Slide 9 text

It’s what you do with it!

Slide 10

Slide 10 text

SQWELL SQHELL

Slide 11

Slide 11 text

SQLWELL ✓Normalization ✓No data duplication ✓Flexible DRL/DQL ✓Relations (JOIN, subqueries, GROUP BY) ✓Everyone knows SQL ✓All RDMBS products speak SQL

Slide 12

Slide 12 text

SQLHELL ➡Normalization ➡Bad indexing is heavy on the storage ➡DRL/DQL is „expensive” ➡Relations & data reassembly ➡Everyone is stuck in the SQL trap ➡SQL is not complete !

Slide 13

Slide 13 text

NoSQL Not Only SQL

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

Forget what you know

Slide 16

Slide 16 text

Adapt your database to your content ! and not vice versa

Slide 17

Slide 17 text

Content ✓Blog post ✓Log file ✓Invoice ✓Geopoint ✓Bank transaction ✓Webshop product ✓Realtime data ✓...

Slide 18

Slide 18 text

What do you want to do?

Slide 19

Slide 19 text

What do you want to do? ✓Full text search ✓Geo sorting/filtering ✓Data analytics ✓Sorting ✓Rapid retrieval ✓Fast storage ✓Huge datasets

Slide 20

Slide 20 text

Strategy

Slide 21

Slide 21 text

Opportunity ✓Cloud ready ➡sharding ➡clustering ➡distributed ➡map/reduce ✓Powerful, fast, reliable

Slide 22

Slide 22 text

Opportunity ✓Alternative output ➡JSON, XML, … ✓Restful ✓Features++ ✓More than storage & retrieval

Slide 23

Slide 23 text

Risk ➡Learning curve ➡Storage ➡Lots of RAM ➡No uniformity ➡Data is „stuck” in a fixed format ➡Mapping? Constraints?

Slide 24

Slide 24 text

Combining technologies

Slide 25

Slide 25 text

SQL + …

Slide 26

Slide 26 text

example

Slide 27

Slide 27 text

curl  http://weten.dev:9200/_search?pretty  -­‐d'   {          "from":  0,          "size":  100,          "query"  :          {                  "filtered"  :                  {                          "query"  :                          {                                  "match_all"  :  {}                          },                          "filter"  :  {                                  "and"  :  [                                          {                                                  "range":                                                  {                                                          "@timestamp"  :  {                                                                  "from":  "2014-­‐06-­‐02T10:00:00Z",                                                                  "to":  "2014-­‐06-­‐04T16:00:00Z"                                                          }                                                  }                                          },                                          {                                                  "term":                                                  {                                                          "geoip.country_code2.raw":  "DE"                                                  }                                          }                                  ]                          }                  }          },          "sort"  :  [                  {"@timestamp"  :  {"order"  :  "desc"}}          ]   }' Query

Slide 28

Slide 28 text

{      "took"  :  36,      "timed_out"  :  false,      "_shards"  :  {          "total"  :  5,          "successful"  :  5,          "failed"  :  0      },      "hits"  :  {          "total"  :  1,          "max_score"  :  1.0,          "hits"  :  [  {              "_index"  :  "logstash-­‐2014.06.03",              "_type"  :  "apache",              "_id"  :  "OS81NlYWTQu4j4O5OZMmXA",              "_score"  :  1.0,              "_source":{"tags":[],"@version": 1,"@timestamp":"2014-­‐06-­‐03T14:37:07.119Z","host":"meten","file":"/var/log/apache2/ access.log","message":"10.10.10.1  -­‐  -­‐  [03/Jun/2014:14:37:07  +0000]  \"GET  /  HTTP/1.1\"  200   483  \"-­‐\"  \"Mozilla/5.0  (Macintosh;  Intel  Mac  OS  X  10.9;  rv:29.0)  Gecko/20100101  Firefox/ 29.0\"","type":"apache","clientip":"217.21.177.69","ident":"-­‐","auth":"-­‐","timestamp":"03/ Jun/2014:14:37:07   +0000","verb":"GET","request":"/","httpversion":"1.1","response":"200","bytes":"483","referr er":"\"-­‐\"","agent":"\"Mozilla/5.0  (Macintosh;  Intel  Mac  OS  X  10.9;  rv:29.0)  Gecko/20100101   Firefox/29.0\"","geoip": {"ip":"217.21.177.69","country_code2":"BE","country_code3":"BEL","country_name":"Belgium","c ontinent_code":"EU","region_name":"08","city_name":"Gentbrugge","latitude": 51.05000000000001,"longitude":3.75,"timezone":"Europe/Brussels","real_region_name":"Oost-­‐ Vlaanderen","location":[3.75,51.05000000000001]}}          }  ]      }   }   Output

Slide 29

Slide 29 text

{      "template"  :  "logstash-­‐*",      "settings"  :  {          "index.refresh_interval"  :  "5s"      },      "mappings"  :  {          "_default_"  :  {                "_all"  :  {"enabled"  :  true},                "dynamic_templates"  :  [  {                    "string_fields"  :  {                        "match"  :  "*",                        "match_mapping_type"  :  "string",                        "mapping"  :  {                            "type"  :  "string",  "index"  :  "analyzed",  "omit_norms"  :   true,                                "fields"  :  {                                    "raw"  :  {"type":  "string",  "index"  :  "not_analyzed",   "ignore_above"  :  256}                                }                        }                    }                }  ],                "properties"  :  {                    "@version":  {  "type":  "string",  "index":  "not_analyzed"  },                    "geoip"    :  {                        "type"  :  "object",                            "dynamic":  true,                            "path":  "full",                            "properties"  :  {                                "location"  :  {  "type"  :  "geo_point"  }                            }                    }                }          }      }   } Mapping

Slide 30

Slide 30 text

example

Slide 31

Slide 31 text

SET  key  value   GET  key   SET  number  2   INCR  number   INCRBY  number  10   APPEND  key  XYZ   HGET  key1  field1   HKEYS  key1   LLEN  key2   SISMEMBER  key3  member1

Slide 32

Slide 32 text

SQL on top of NoSQL

Slide 33

Slide 33 text

This is just the tip of the iceberg

Slide 34

Slide 34 text

No content