SlideShare a Scribd company logo
An e-commerce app in action built
on top of a multi-model database
Max Neunhöffer
6 June 2017
www.arangodb.com
The Multi-Model Approach
Native multi-model database
A native multi-model database combines a document store with a graph
database and is at the same time a key/value store,
with a common query language for all three data models.
Important:
Is able to compete with specialised products on their turf.
Allows for polyglot persistence using a single database technology.
In a microservice architecture, there will be several different deployments.
Use case: Aircraft fleet management
Use case: Aircraft fleet management
One of our customers uses ArangoDB to
store each part, component, unit or aircraft as a document
model containment as a graph
thus can easily find all parts of some component
keep track of maintenance intervals
perform queries orthogonal to the graph structure
thereby getting good efficiency for all needed queries
http://radar.oreilly.com/2015/07/
data-modeling-with-multi-model-databases.html
Why is multi-model possible at all?
Document stores and key/value stores
Document stores: have primary key, are key/value stores.
Without using secondary indexes, performance is nearly as good as with
opaque data instead of JSON.
Good horizontal scalability can be achieved for key lookups.
https://www.arangodb.com/2015/10/benchmark-postgresql-mongodb-arangodb/
Why is multi-model possible at all?
Document stores and graph databases
Graph database: would like to associate arbitrary data with vertices and
edges, so JSON documents are a good choice.
A good edge index, giving fast access to neighbours.
This can be a secondary index.
Graph support in the query language.
Implementations of graph algorithms in the DB engine.
https://www.arangodb.com/2015/10/benchmark-postgresql-mongodb-arangodb/
Powerful query language
AQL
The built in Arango Query Language allows
complex, powerful and convenient queries,
with transaction semantics,
allowing to do joins,
and to do graph queries,
AQL is independent of the driver used and
offers protection against injections by design.
Example AQL queries 1
Show new customers from 2016
FOR c IN customers
FILTER c.memberSince >= "2016"
RETURN c
Example AQL queries 2
Count all customers
FOR c IN customers
COLLECT WITH COUNT INTO count
RETURN {"number of customers": count}
Example AQL queries 3
Show the number of new customers in 2015
FOR c IN customers
FILTER c.memberSince >= "2015" && c.memberSince < "2016"
COLLECT WITH COUNT INTO count
RETURN {"number of new customers in 2015": count}
Example AQL queries 4
Statistics about signup numbers over years
FOR c IN customers
COLLECT y = SUBSTRING(c.memberSince,0,4) WITH COUNT INTO count
SORT y DESC
RETURN { year: y, noNewCustomers: count }
Example AQL queries 5
Show 10 first items with a price over 200
FOR i IN items
FILTER i.price >= 200
LIMIT 10
RETURN i
Example AQL queries 6
Show all sales of October 2016
FOR s IN sales
FILTER s.date >= "2016-10-01" && s.date < "2016-11-01"
SORT s.date
RETURN { date: s.date, billingId: s.billingId }
Example AQL queries 7
Join the price
FOR s IN sales
FILTER s.date >= "2016-10-01" && s.date < "2016-11-01"
SORT s.date
FOR i IN items
FILTER i._id == s._to
RETURN {date:s.date,billingId:s.billingId,price:i.price}
Example AQL queries 8
Show complete orders
FOR s IN sales
FOR i IN items
FILTER i._id == s._to
COLLECT bill = s.billingId INTO items
FOR c IN customers
FILTER c._id == items[0].s._from
RETURN { date: items[0].s.date, billingId: bill,
name: c.name, price: SUM(items[*].i.price),
items: items[*].i }
Example AQL queries 9
Find top sellers (using graph)
FOR item IN items
LET buyers =
(FOR v IN 1..1 INBOUND item GRAPH "sales" RETURN v)
LET nr = LENGTH(buyers)
SORT nr DESC
RETURN { description: item.description,
orderId: item.orderId, nrSales: nr }
Example AQL queries 10
Given a customer, find all items he has bought
LET customer = DOCUMENT("customers/hugo")
FOR i IN 1..1 OUTBOUND customer GRAPH "sales"
COLLECT orderId = i.orderId INTO list
RETURN { orderId, description: list[0].i.description,
count: LENGTH(list), customer }
Example AQL queries 11
Find recommendations
LET customer = DOCUMENT("customers/lulu")
FOR i, e, p IN 3..3 ANY customer GRAPH "sales"
OPTIONS { uniqueVertices: "none", uniqueEdges: "none" }
FILTER p.vertices[2]._key != customer._key
COLLECT orderId = i.orderId INTO list
RETURN { orderId, description: list[0].i.description,
count: LENGTH(list), customer: customer.name,
path: list[0].p.vertices[*]._key }
Links
https://www.arangodb.com
https://docs.arangodb.com/cookbook/index.html
https://docs.arangodb.com/3.1/Manual/Foxx/
https://github.com/hapijs/joi

More Related Content

PPTX
AWS Amplify 入門
PPTX
WiredTigerを詳しく説明
PDF
OpenStack超入門シリーズ いまさら聞けないNeutronの使い方
PDF
Prometeusについてはじめてみよう / Let's start Prometeus
PPTX
[CVPR2020読み会@CV勉強会] 3D Packing for Self-Supervised Monocular Depth Estimation
PDF
実践! Argo cd &amp; rollouts による canary release(cndt2021)
PDF
【CVPR 2020 メタサーベイ】3D From a Single Image and Shape-From-X
PDF
HoloLens 2 開発入門 (公式チュートリアルの紹介)
AWS Amplify 入門
WiredTigerを詳しく説明
OpenStack超入門シリーズ いまさら聞けないNeutronの使い方
Prometeusについてはじめてみよう / Let's start Prometeus
[CVPR2020読み会@CV勉強会] 3D Packing for Self-Supervised Monocular Depth Estimation
実践! Argo cd &amp; rollouts による canary release(cndt2021)
【CVPR 2020 メタサーベイ】3D From a Single Image and Shape-From-X
HoloLens 2 開発入門 (公式チュートリアルの紹介)

What's hot (20)

PPTX
Microsoft Endpoint Configuration Manager 概要
PDF
Amazon RDS for PostgreSQLのインスタンス(DB)作成手順
PDF
C++からWebRTC (DataChannel)を利用する
PDF
IT エンジニアのための 流し読み Windows 10 - Windows のネットワーク最適化機能
PPTX
Internet explorer イントラネットの判定と挙動
PPTX
Laser projector opportunity (MetaZtron Vision)
PDF
Github codespaces すごく良い。もうこれで 十分なんじゃという話
PDF
オープンソースのAPIゲートウェイ Kong ご紹介
PPTX
ソフトウェア更新プログラム (パッチ) 管理手法勉強会 1 回目
PPTX
MRTKをNreal Lightに対応させてみた
PDF
Juju/MAASで作る Kubernetes + GPU
PDF
「NVIDIA プロファイラを用いたPyTorch学習最適化手法のご紹介(修正前 typoあり)」
PDF
「Neutronになって理解するOpenStack Network」~Neutron/Open vSwitchなどNeutronと周辺技術の解説~ - ...
PDF
PostgreSQL Query Cache - "pqc"
PDF
20231109_OpenID_TechNight_OpenID_Federation.pdf
PPTX
FIWARE アーキテクチャの保護 - FIWARE WednesdayWebinars
PPTX
FIWARE implementation of IDS concepts
PDF
Azure DevOps Online Vol.3 - Inside Azure Pipelines
PDF
新 Microsoft Edge を Intune で配信・管理する
PPTX
明治大学理工学部 特別講義 AI on Azure
Microsoft Endpoint Configuration Manager 概要
Amazon RDS for PostgreSQLのインスタンス(DB)作成手順
C++からWebRTC (DataChannel)を利用する
IT エンジニアのための 流し読み Windows 10 - Windows のネットワーク最適化機能
Internet explorer イントラネットの判定と挙動
Laser projector opportunity (MetaZtron Vision)
Github codespaces すごく良い。もうこれで 十分なんじゃという話
オープンソースのAPIゲートウェイ Kong ご紹介
ソフトウェア更新プログラム (パッチ) 管理手法勉強会 1 回目
MRTKをNreal Lightに対応させてみた
Juju/MAASで作る Kubernetes + GPU
「NVIDIA プロファイラを用いたPyTorch学習最適化手法のご紹介(修正前 typoあり)」
「Neutronになって理解するOpenStack Network」~Neutron/Open vSwitchなどNeutronと周辺技術の解説~ - ...
PostgreSQL Query Cache - "pqc"
20231109_OpenID_TechNight_OpenID_Federation.pdf
FIWARE アーキテクチャの保護 - FIWARE WednesdayWebinars
FIWARE implementation of IDS concepts
Azure DevOps Online Vol.3 - Inside Azure Pipelines
新 Microsoft Edge を Intune で配信・管理する
明治大学理工学部 特別講義 AI on Azure
Ad

Similar to An E-commerce App in action built on top of a Multi-model Database (20)

PDF
Inawisdom MLOPS
PDF
Building a Data Warehouse for Business Analytics using Spark SQL-(Blagoy Kalo...
PDF
Simplifying & accelerating application development with MongoDB's intelligent...
PDF
Michael Hackstein - Polyglot Persistence & Multi-Model NoSQL Databases - NoSQ...
PDF
Angular Project Report
PDF
Databricks-EN-2.pdf
PPT
Building Bi Dashboards With SAS Gauges and SAS BI Portal
PPTX
N1QL workshop: Indexing & Query turning.
PDF
Sap analytics creating smart business processes
PPTX
Pre-Con Ed: There has to be a Better Way to Fast Test Coverage!
PPTX
Designing a Future-proof API Program
PDF
Your Roadmap for An Enterprise Graph Strategy
PDF
GraphQL vs REST_ Choosing the Best API for Shopify Headless Commerce Developm...
PPTX
Tuning N1QL Query Performance with Couchbase Server 4.0
PDF
AWS Cost Allocation best practices: How high-growth businesses succeed
PDF
ArangoDB – A different approach to NoSQL
PPTX
비용을 절감하고 수익을 최대화할 수 있는 클라우드 컴퓨팅 운용 노하우
PDF
Using Elasticsearch for Analytics
PDF
AWS Cost Optimization in 5 Perspective
DOC
Kiran ABAP Resume 3yrs
Inawisdom MLOPS
Building a Data Warehouse for Business Analytics using Spark SQL-(Blagoy Kalo...
Simplifying & accelerating application development with MongoDB's intelligent...
Michael Hackstein - Polyglot Persistence & Multi-Model NoSQL Databases - NoSQ...
Angular Project Report
Databricks-EN-2.pdf
Building Bi Dashboards With SAS Gauges and SAS BI Portal
N1QL workshop: Indexing & Query turning.
Sap analytics creating smart business processes
Pre-Con Ed: There has to be a Better Way to Fast Test Coverage!
Designing a Future-proof API Program
Your Roadmap for An Enterprise Graph Strategy
GraphQL vs REST_ Choosing the Best API for Shopify Headless Commerce Developm...
Tuning N1QL Query Performance with Couchbase Server 4.0
AWS Cost Allocation best practices: How high-growth businesses succeed
ArangoDB – A different approach to NoSQL
비용을 절감하고 수익을 최대화할 수 있는 클라우드 컴퓨팅 운용 노하우
Using Elasticsearch for Analytics
AWS Cost Optimization in 5 Perspective
Kiran ABAP Resume 3yrs
Ad

More from ArangoDB Database (20)

PPTX
ATO 2022 - Machine Learning + Graph Databases for Better Recommendations (3)....
PPTX
Machine Learning + Graph Databases for Better Recommendations V2 08/20/2022
PPTX
Machine Learning + Graph Databases for Better Recommendations V1 08/06/2022
PPTX
ArangoDB 3.9 - Further Powering Graphs at Scale
PDF
GraphSage vs Pinsage #InsideArangoDB
PDF
Webinar: ArangoDB 3.8 Preview - Analytics at Scale
PDF
Graph Analytics with ArangoDB
PDF
Getting Started with ArangoDB Oasis
PDF
Custom Pregel Algorithms in ArangoDB
PPTX
Hacktoberfest 2020 - Intro to Knowledge Graphs
PDF
A Graph Database That Scales - ArangoDB 3.7 Release Webinar
PDF
gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?
PDF
ArangoML Pipeline Cloud - Managed Machine Learning Metadata
PDF
ArangoDB 3.7 Roadmap: Performance at Scale
PDF
Webinar: What to expect from ArangoDB Oasis
PDF
ArangoDB 3.5 Feature Overview Webinar - Sept 12, 2019
PDF
3.5 webinar
PDF
Webinar: How native multi model works in ArangoDB
PDF
An introduction to multi-model databases
PDF
Running complex data queries in a distributed system
ATO 2022 - Machine Learning + Graph Databases for Better Recommendations (3)....
Machine Learning + Graph Databases for Better Recommendations V2 08/20/2022
Machine Learning + Graph Databases for Better Recommendations V1 08/06/2022
ArangoDB 3.9 - Further Powering Graphs at Scale
GraphSage vs Pinsage #InsideArangoDB
Webinar: ArangoDB 3.8 Preview - Analytics at Scale
Graph Analytics with ArangoDB
Getting Started with ArangoDB Oasis
Custom Pregel Algorithms in ArangoDB
Hacktoberfest 2020 - Intro to Knowledge Graphs
A Graph Database That Scales - ArangoDB 3.7 Release Webinar
gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?
ArangoML Pipeline Cloud - Managed Machine Learning Metadata
ArangoDB 3.7 Roadmap: Performance at Scale
Webinar: What to expect from ArangoDB Oasis
ArangoDB 3.5 Feature Overview Webinar - Sept 12, 2019
3.5 webinar
Webinar: How native multi model works in ArangoDB
An introduction to multi-model databases
Running complex data queries in a distributed system

Recently uploaded (20)

PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Encapsulation theory and applications.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Approach and Philosophy of On baking technology
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
KodekX | Application Modernization Development
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
Building Integrated photovoltaic BIPV_UPV.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Diabetes mellitus diagnosis method based random forest with bat algorithm
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Encapsulation theory and applications.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
20250228 LYD VKU AI Blended-Learning.pptx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Unlocking AI with Model Context Protocol (MCP)
Approach and Philosophy of On baking technology
Reach Out and Touch Someone: Haptics and Empathic Computing
MIND Revenue Release Quarter 2 2025 Press Release
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
KodekX | Application Modernization Development
Digital-Transformation-Roadmap-for-Companies.pptx
NewMind AI Weekly Chronicles - August'25 Week I
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
The Rise and Fall of 3GPP – Time for a Sabbatical?

An E-commerce App in action built on top of a Multi-model Database

  • 1. An e-commerce app in action built on top of a multi-model database Max Neunhöffer 6 June 2017 www.arangodb.com
  • 2. The Multi-Model Approach Native multi-model database A native multi-model database combines a document store with a graph database and is at the same time a key/value store, with a common query language for all three data models. Important: Is able to compete with specialised products on their turf. Allows for polyglot persistence using a single database technology. In a microservice architecture, there will be several different deployments.
  • 3. Use case: Aircraft fleet management
  • 4. Use case: Aircraft fleet management One of our customers uses ArangoDB to store each part, component, unit or aircraft as a document model containment as a graph thus can easily find all parts of some component keep track of maintenance intervals perform queries orthogonal to the graph structure thereby getting good efficiency for all needed queries http://radar.oreilly.com/2015/07/ data-modeling-with-multi-model-databases.html
  • 5. Why is multi-model possible at all? Document stores and key/value stores Document stores: have primary key, are key/value stores. Without using secondary indexes, performance is nearly as good as with opaque data instead of JSON. Good horizontal scalability can be achieved for key lookups. https://www.arangodb.com/2015/10/benchmark-postgresql-mongodb-arangodb/
  • 6. Why is multi-model possible at all? Document stores and graph databases Graph database: would like to associate arbitrary data with vertices and edges, so JSON documents are a good choice. A good edge index, giving fast access to neighbours. This can be a secondary index. Graph support in the query language. Implementations of graph algorithms in the DB engine. https://www.arangodb.com/2015/10/benchmark-postgresql-mongodb-arangodb/
  • 7. Powerful query language AQL The built in Arango Query Language allows complex, powerful and convenient queries, with transaction semantics, allowing to do joins, and to do graph queries, AQL is independent of the driver used and offers protection against injections by design.
  • 8. Example AQL queries 1 Show new customers from 2016 FOR c IN customers FILTER c.memberSince >= "2016" RETURN c
  • 9. Example AQL queries 2 Count all customers FOR c IN customers COLLECT WITH COUNT INTO count RETURN {"number of customers": count}
  • 10. Example AQL queries 3 Show the number of new customers in 2015 FOR c IN customers FILTER c.memberSince >= "2015" && c.memberSince < "2016" COLLECT WITH COUNT INTO count RETURN {"number of new customers in 2015": count}
  • 11. Example AQL queries 4 Statistics about signup numbers over years FOR c IN customers COLLECT y = SUBSTRING(c.memberSince,0,4) WITH COUNT INTO count SORT y DESC RETURN { year: y, noNewCustomers: count }
  • 12. Example AQL queries 5 Show 10 first items with a price over 200 FOR i IN items FILTER i.price >= 200 LIMIT 10 RETURN i
  • 13. Example AQL queries 6 Show all sales of October 2016 FOR s IN sales FILTER s.date >= "2016-10-01" && s.date < "2016-11-01" SORT s.date RETURN { date: s.date, billingId: s.billingId }
  • 14. Example AQL queries 7 Join the price FOR s IN sales FILTER s.date >= "2016-10-01" && s.date < "2016-11-01" SORT s.date FOR i IN items FILTER i._id == s._to RETURN {date:s.date,billingId:s.billingId,price:i.price}
  • 15. Example AQL queries 8 Show complete orders FOR s IN sales FOR i IN items FILTER i._id == s._to COLLECT bill = s.billingId INTO items FOR c IN customers FILTER c._id == items[0].s._from RETURN { date: items[0].s.date, billingId: bill, name: c.name, price: SUM(items[*].i.price), items: items[*].i }
  • 16. Example AQL queries 9 Find top sellers (using graph) FOR item IN items LET buyers = (FOR v IN 1..1 INBOUND item GRAPH "sales" RETURN v) LET nr = LENGTH(buyers) SORT nr DESC RETURN { description: item.description, orderId: item.orderId, nrSales: nr }
  • 17. Example AQL queries 10 Given a customer, find all items he has bought LET customer = DOCUMENT("customers/hugo") FOR i IN 1..1 OUTBOUND customer GRAPH "sales" COLLECT orderId = i.orderId INTO list RETURN { orderId, description: list[0].i.description, count: LENGTH(list), customer }
  • 18. Example AQL queries 11 Find recommendations LET customer = DOCUMENT("customers/lulu") FOR i, e, p IN 3..3 ANY customer GRAPH "sales" OPTIONS { uniqueVertices: "none", uniqueEdges: "none" } FILTER p.vertices[2]._key != customer._key COLLECT orderId = i.orderId INTO list RETURN { orderId, description: list[0].i.description, count: LENGTH(list), customer: customer.name, path: list[0].p.vertices[*]._key }