RethinkDB v1.5-1.6 patch: Get on it!

In this article I will attempt to bring you up to speed with the latest workings of RethinkDB. If, like me, you’ve been busy the past few months and you haven’t had time to keep up-to-date this post should help you greatly. As you can see from the Notes chapter, A LOT has changed with RethinkDB from v1.4x. Including the binary structure, which means you had to export/import your database from v1.4 to v1.6. Even if you’re upgrading from 1.5 to 1.6 you will need to do an export/import.

New things

Secondary Indexes

The most anticipated feature to 1.5 was Secondary Indexes. This allows you to tell the Database that there are other columns that you are likely to perform searches on so that it can get prepared and implement systems to make searching on those columns quicker.

Adding an index

You obviously need to tell the database which columns you want to use as an index and you do that with index_create.

This will create a new index on the column title in your Todo database.

Deleting an index

If things change and that column is no-longer a primary column for searching then you can remove it from the index list using index_drop.

 Show all indexes

If you need to view all the indexes on a given table, you can use index_list.

Durability Overview

We now have some options in the way that the server handles data submitted to it. Previously, the only option for Durability was hard.

Hard

Acknowledgement of writes happens after data has been written to disk.

Soft

Writes will be acknowledged by the server immediately and flushed to disk in the background.

Applied Durability

Durability options can be overridden by certain commands. This allows you to prioritise integrity or speed in certain parts of your application.

Table create

The table create method now has the durability option, which allows you to specify the default durability type for this table.

Insert/Update/Replace

This is a place where I envision the durability option to be of most benefit. The option to specify whether an insert/update/replace query should be soft on a hard table could really improve the speed of an application.

Insert

Update

Replace

 

 

Notes

 

Dave

About David Parlevliet

Dave is long time developer with a passion toward teaching. He divides his time between his wife, her cat and his projects. He recently started using twitter so make sure to follow him!