RethinkDB
Not Only Sql Presentation
Zico Abhi Dey
University Of Goettingen
A Brief Overview
RethinkDB is
 first open-source, scalable JSON database built for the
realtime web.
 Different from traditional databases. Instead of polling for
changes, RethinkDB allows continuously push updated
query results in realtime.
 Official support for Ubuntu, OS X, CentOS and Debian.
How to Install:: On OS x Using Python
Server Install: Download package and simple click to
install.
Client Server: Simple Terminal Command.
$ sudo pip install rethinkdb
Access:
 Start Server from terminal with $ rethinkdb
 From Browser 127.0.0.1:8080 OR localhost:8080
Data manipulation
Database Creation
From GUI.
Or
From Python Shell: r.db_create(“library”).run()
Table Creation
From GUI.
Or
From Python Shell: r.db(“library”).table_create(“Book”).run()
Insert Data :: From Python Shell
Book.insert({ "BookID":"123", "Author": "Date",
"Title":"Introduction to DBS"}, { "BookID": "234",
"Author":"Jones", "Title": "Algorithms"}, { "BookID": "345",
"Author": "Kings", "Title": "Operating Systems"}).run()
Delete Data:: From Python Shell
r.table(“Book”).filter(r.row[“Author”] ==
“Kings”).delete().run()
Programmatic access
officially support for client drivers javascript, ruby and
python. You can run queries from the command shell.
Query a
print r.table('Book').pluck('Title').run()
Query b
print r.table('Book').inner_join(r.table('BookLending'), lambda
x ,y: x["BookID"] == y["BookID"]).zip().run()
Query c
print r.table('Book').inner_join(r.table('BookLending'), lambda
x ,y: x["BookID"] ==
y["BookID"]).zip().filter(r.row["ReturnDate"] < '27-10-
2012').run()
Query d
print r.table('Book').inner_join(r.table('BookLending'), lambda
x ,y: x["BookID"] ==
y["BookID"]).zip().inner_join(r.table('Reader'), lambda x ,y:
x["ReaderID"] ==
y["ReaderID"]).zip().filter(r.row["Name"]=='Peter').run()
Declarative query language
Has its own declarative query language Reql. Reql queries
using Data explorer of RethinkDB.
Query a
r.table('Book').pluck('Title')
Query b
r.table('Book').innerJoin(r.table('BookLending'),
function(marvelRow, dcRow) { return
marvelRow('BookID').eq(dcRow('BookID'))}).zip()
Query c
r.table('Book').innerJoin(r.table('BookLending'),
function(marvelRow, dcRow) { return
marvelRow('BookID').eq(dcRow('BookID'))
}).zip().filter(r.row("ReturnDate").lt('29-10-2012'))
Query d
r.table('Book').innerJoin(r.table('BookLending'),
function(marvelRow, dcRow) { return
marvelRow('BookID').eq(dcRow('BookID'))
}).zip().innerJoin(r.table('Reader'), function(marvelRow, dcRow) {
return marvelRow('ReaderID').eq(dcRow('ReaderID'))
}).zip().filter(r.row("Name").eq('Peter'))
HTTP-based access
r.http command for accessing external APIs directly from
the database.
REST-based access
Has not been introduced yet.
Support for transactions
Yes. Multiple operations can be performed in a single update
operation
Support for indexing
Simple indexes: based on the value of a single field.
Compound indexes: based on multiple fields.
Multi indexes: based on arrays of values.
Aggregation
Yes the system supports aggregation operations like
SUM, COUNT, MAX
Query e:: from Python Shell
print r.table('BookLending').inner_join(r.table('Reader'),
lambda x ,y: x["ReaderID"] ==
y["ReaderID"]).zip().filter(r.row["Name"] ==
'Laura').count().run()
Query e:: from Data Explorer
r.table('BookLending').innerJoin(r.table('Reader'),
function(marvelRow, dcRow) { return
marvelRow('ReaderID').eq(dcRow('ReaderID'))
}).zip().filter(r.row("Name").eq('Laura')).count()
RethinkDB as a distributed database system?
Yes it is possible to attach multiple machine to the cluster
in RethinkDB.
RethinkDB support autosharding?
No. Manual Shard only using GUI.
RethinkDB support replication?
Yes support multi-master replication. RethinkDB has
advantage in failover.
Replication can be performed via GUI. OR using Reql
queries.
Thank You
Any Questions?

Rethinkdb

  • 1.
    RethinkDB Not Only SqlPresentation Zico Abhi Dey University Of Goettingen
  • 2.
    A Brief Overview RethinkDBis  first open-source, scalable JSON database built for the realtime web.  Different from traditional databases. Instead of polling for changes, RethinkDB allows continuously push updated query results in realtime.  Official support for Ubuntu, OS X, CentOS and Debian. How to Install:: On OS x Using Python Server Install: Download package and simple click to install. Client Server: Simple Terminal Command. $ sudo pip install rethinkdb Access:  Start Server from terminal with $ rethinkdb  From Browser 127.0.0.1:8080 OR localhost:8080
  • 3.
    Data manipulation Database Creation FromGUI. Or From Python Shell: r.db_create(“library”).run() Table Creation From GUI. Or From Python Shell: r.db(“library”).table_create(“Book”).run() Insert Data :: From Python Shell Book.insert({ "BookID":"123", "Author": "Date", "Title":"Introduction to DBS"}, { "BookID": "234", "Author":"Jones", "Title": "Algorithms"}, { "BookID": "345", "Author": "Kings", "Title": "Operating Systems"}).run() Delete Data:: From Python Shell r.table(“Book”).filter(r.row[“Author”] == “Kings”).delete().run()
  • 4.
    Programmatic access officially supportfor client drivers javascript, ruby and python. You can run queries from the command shell. Query a print r.table('Book').pluck('Title').run() Query b print r.table('Book').inner_join(r.table('BookLending'), lambda x ,y: x["BookID"] == y["BookID"]).zip().run() Query c print r.table('Book').inner_join(r.table('BookLending'), lambda x ,y: x["BookID"] == y["BookID"]).zip().filter(r.row["ReturnDate"] < '27-10- 2012').run() Query d print r.table('Book').inner_join(r.table('BookLending'), lambda x ,y: x["BookID"] == y["BookID"]).zip().inner_join(r.table('Reader'), lambda x ,y: x["ReaderID"] == y["ReaderID"]).zip().filter(r.row["Name"]=='Peter').run()
  • 5.
    Declarative query language Hasits own declarative query language Reql. Reql queries using Data explorer of RethinkDB. Query a r.table('Book').pluck('Title') Query b r.table('Book').innerJoin(r.table('BookLending'), function(marvelRow, dcRow) { return marvelRow('BookID').eq(dcRow('BookID'))}).zip() Query c r.table('Book').innerJoin(r.table('BookLending'), function(marvelRow, dcRow) { return marvelRow('BookID').eq(dcRow('BookID')) }).zip().filter(r.row("ReturnDate").lt('29-10-2012')) Query d r.table('Book').innerJoin(r.table('BookLending'), function(marvelRow, dcRow) { return marvelRow('BookID').eq(dcRow('BookID')) }).zip().innerJoin(r.table('Reader'), function(marvelRow, dcRow) { return marvelRow('ReaderID').eq(dcRow('ReaderID')) }).zip().filter(r.row("Name").eq('Peter'))
  • 6.
    HTTP-based access r.http commandfor accessing external APIs directly from the database. REST-based access Has not been introduced yet. Support for transactions Yes. Multiple operations can be performed in a single update operation Support for indexing Simple indexes: based on the value of a single field. Compound indexes: based on multiple fields. Multi indexes: based on arrays of values.
  • 7.
    Aggregation Yes the systemsupports aggregation operations like SUM, COUNT, MAX Query e:: from Python Shell print r.table('BookLending').inner_join(r.table('Reader'), lambda x ,y: x["ReaderID"] == y["ReaderID"]).zip().filter(r.row["Name"] == 'Laura').count().run() Query e:: from Data Explorer r.table('BookLending').innerJoin(r.table('Reader'), function(marvelRow, dcRow) { return marvelRow('ReaderID').eq(dcRow('ReaderID')) }).zip().filter(r.row("Name").eq('Laura')).count()
  • 8.
    RethinkDB as adistributed database system? Yes it is possible to attach multiple machine to the cluster in RethinkDB. RethinkDB support autosharding? No. Manual Shard only using GUI. RethinkDB support replication? Yes support multi-master replication. RethinkDB has advantage in failover. Replication can be performed via GUI. OR using Reql queries.
  • 9.