Categories
Posts

Thredis, the Peanut Butter Cup of Databases

Ever wonder what would happen if you dipped SQLite into Redis? You get Thredis, the peanut butter cup of databases:

Thredis embeds an in-memory SQLite database within Redis to enable a
sophisticated level of SQL (joins, sub-selects, etc, all supported),
as well as introduces multi-threaded processing to take advantage of
SMP systems.

This is one wild hack, check out one of the examples:

[sourcecode]
redis 127.0.0.1:6379> zadd foo_zset 1 a 2 b 3 c
(integer) 3
redis 127.0.0.1:6379> sql "create virtual table zset using redis (foo_zset)"
OK
redis 127.0.0.1:6379> sql "select * from zset"
1) 1) "key"
2) "val"
2) 1) "1.0"
2) "a"
3) 1) "2.0"
2) "b"
4) 1) "3.0"
2) "c"
[/sourcecode]

More examples are listed at http://thredis.org/, source code is available at https://github.com/grisha/thredis.

Leave a Reply

Your email address will not be published. Required fields are marked *