5. name: Newton
type: user
name: Hercules
type: user
title: “How to deal with Father issues”
type: book
title: “Muscle building for beginners”
type: book
title: “Dancing with the Stars”
type: DVD
title: “Friends forever bracelet”
type: Accessory
6. name: Newton
type: user
name: Hercules
type: user
bought
bought
bought
viewed
in-Cart
title: “How to deal with Father issues”
type: book
title: “Muscle building for beginners”
type: book
title: “Dancing with the Stars”
type: DVD
title: “Friends forever bracelet”
type: Accessory
7. name: Newton
type: user
name: Hercules
type: user
bought
time:24
bought
bought
time:22
time:20
viewed
in-Cart
time:05
time:09
title: “How to deal with Father issues”
type: book
title: “Muscle building for beginners”
type: book
title: “Dancing with the Stars”
type: DVD
title: “Friends forever bracelet”
type: Accessory
8. name: Newton
type: user
name: Hercules
type: user
bought
time:24
bought
bought
time:22
time:20
viewed
in-Cart
time:05
time:09
title: “How to deal with Father issues”
type: book
title: “Muscle building for beginners”
type: book
title: “Dancing with the Stars”
type: DVD
title: “Friends forever bracelet”
type: Accessory
10. Home-grown Solution
! Start with your favorite NoSQL database
! Cassandra, MongoDB, HBase, etc
1. Error-prone
2. Data model moves into application code
3. Maintainability hazard
4. No query language support
5. No performance optimization
11. Relational Database
! Relationship tables, SQL and joins
1. Join processing is expensive
2. Join processing on large tables does not scale
3. Cumbersome query language
4. Inflexible data model
12. SELECT P.title
FROM
User U1 JOIN Purchase P1 ON P1.buyerid = U1.userid
JOIN Purchase P2 ON P1.productid=P2.productid
JOIN Purchase P3 ON P2.buyerid=P3.buyerid
JOIN Product P ON P3.productid = P.productid
WHERE
U1.name=“xyz” AND P1.time>T1 AND P2.time>T1
13. Relational Database
! Relationship tables, joins, and SQL
1. Join processing is expensive
2. Join processing on large tables does not scale
3. Cumbersome query language
4. Inflexible data model
14. name: Newton
type: user
name: Hercules
type: user
bought
friends
time:24
bought
bought
time:22
time:20
viewed
in-Cart
time:05
duration: 60
time:09
name: Saturn
type: author
author
author
title: “How to deal with Father issues”
type: book
title: “Muscle building for beginners”
type: book
title: “Dancing with the Stars”
type: DVD
title: “Friends forever bracelet”
type: Accessory
18. name: Newton
type: user
name: Hercules
type: user
bought
friends
time:24
bought
bought
time:22
time:20
viewed
in-Cart
time:05
duration: 60
time:09
name: Saturn
type: author
author
author
title: “How to deal with Father issues”
type: book
title: “Muscle building for beginners”
type: book
title: “Dancing with the Stars”
type: DVD
title: “Friends forever bracelet”
type: Accessory
22. Vertex-Centric Indices
! Sort and index edges per
vertex by sor tkey
! Sort key can be composite
! Enables efficient focused
traversals
! Only retrieve edges that matter
! Uses push down predicates for
quick, index-driven retrieval
32. Transaction Description Avg (ms) Stdev (ms)
Student retrieves all content for a
single course in their course list 279.32 81.83
Student follows another student
193.72 22.77
Student is recommended people
to follow 241.33 256.48
Student reads their stream and
shares an item with followers 284.07 68.20
Student retrieves their profile 53.740 22.61
Student reads the most recent
comments for their courses 211.07 45.56
33. x = [] as Set; m = [:]!
m = user.out('follows').aggregate(x)[0..(num*2)]!
!.out('follows').except(x)[0..limit]!
!.groupCount(m);!
!
m.sort{-it.value}[0..num]._()!
!.transform{ [userid: it.key.id, !
! ! ! ! ! ! points: it.value]};!
&IFFIQ 2?=IGG?H>;NCIH