Skip to content

Instantly share code, notes, and snippets.

@joerg84
Last active September 12, 2019 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joerg84/1c3c8ec2f2424d6ab649b6293f4dcb87 to your computer and use it in GitHub Desktop.
Save joerg84/1c3c8ec2f2424d6ab649b6293f4dcb87 to your computer and use it in GitHub Desktop.

PRUNE

https://www.arangodb.com/graphcourse_demodata_arangodb-2/

Import Statements: airports: arangoimport --file "airports.csv" --type csv --collection "airports" --create-collection true

flights: arangoimport --file "flights.csv" --type csv --collection "flights" --create-collection true --create-collection-type edge

SMART Join

Create DB

db._create("products", { numberOfShards: 3, shardKeys: ["_key"] }); db._create("orders", { distributeShardsLike: "products", shardKeys: ["productId"] });

Import Data

db.products.insert({ _key: "abc-10001", name: "Hyper Booster" });
db.products.insert({ _key: "hlc-79452", name: "Holographic Horoscope" });
db.products.insert({ _key: "zxf-19414", name: "Nutty Nunchaku" });

db.orders.insert({ productId: "abc-10001", items: 2, date: "2019-02-17" });
db.orders.insert({ productId: "abc-10001", items: 1, date: "2019-03-21" });
db.orders.insert({ productId: "abc-10001", items: 4, date: "2019-03-25" });
db.orders.insert({ productId: "abc-10001", items: 1, date: "2019-03-26" });
db.orders.insert({ productId: "hlc-79452", items: 9, date: "2018-12-31" });
db.orders.insert({ productId: "hlc-79452", items: 1, date: "2019-01-01" });
db.orders.insert({ productId: "zxf-19414", items: 1, date: "2018-10-25" });
db.orders.insert({ productId: "zxf-19414", items: 2, date: "2019-03-12" });
db.orders.insert({ productId: "zxf-19414", items: 7, date: "2019-03-25" });

#List Per Shard
db.products.count(true); db.orders.count(true);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment