Skip to content
This repository was archived by the owner on Jul 11, 2021. It is now read-only.

Commit e1d194a

Browse files
author
Simone Mosciatti
committed
add release note for 0.7.0
1 parent c2b9170 commit e1d194a

3 files changed

Lines changed: 156 additions & 2 deletions

File tree

doc/docs/blog/release_0.7.0.md

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# Release 0.7.0 of RediSQL, SQL steroids for Redis
2+
3+
#### RediSQL, Redis on SQL steroids.
4+
5+
RediSQL is a Redis module that provides full SQL capabilities to Redis, it is the simplest and fastest way to get an SQL database up and running, without incurring in difficult operational issues and it can scale quite well with your business.
6+
7+
The fastest introduction to RediSQL is [our homepage](https://redisql.com)
8+
9+
**tl;dr** This release introduce a new commands [`REDISQL.COPY`][redisql_copy] that copy the content from a source database into a destination database.
10+
11+
12+
## Motivations
13+
14+
Since from the very first release and the very first user, we have been asked a lot about the possibility to copy SQLite database into disk or into memory.
15+
16+
It is definitely an useful feature, suppose to already have the database and you simply want to make it available to some of your services.
17+
18+
We wait a bit before to incorporate on RediSQL such capabilities, mostly because we weren’t sure about the API to offer.
19+
20+
Finally we decide to pull the trigger and we implemented a new command [`REDISQL.COPY`][redisql_copy].
21+
22+
The [`REDISQL.COPY`][redisql_copy] command takes two parameters as input, a `source` database and a `destination` database and it overwrite the content of the `source` database into the `destination` database.
23+
24+
It is important to understand that the content of the destination database is completely lost after a `REDISQL.COPY`
25+
26+
The [`REDISQL.COPY`][redisql_copy] command takes as input two databases, both of them must be created using the `REDISQL.CREATE_DB` command.
27+
This API allows several use cases that are quite interesting.
28+
29+
1. Make a backup/copy of your database
30+
2. Split load to multiple threads
31+
3. Move a database from a in-memory database to a disk-based database
32+
4. Move a database from a disk-based database to a in-memory database
33+
34+
35+
### Few Examples
36+
37+
I will show briefly some examples of those use cases.
38+
39+
Making a backup/copy
40+
41+
Backups are already provided by the internal of Redis itself, all the database will be copied into the RDB files.
42+
However you may be interested in having just a copy of your database, so that you can archive it in a different way, or just explore it offline.
43+
44+
Suppose you have your database `DB` running with some table and some data:
45+
46+
47+
> REDISQL.CREATE_DB DB
48+
OK
49+
> REDISQL.EXEC DB "CREATE TABLE foo( ... )"
50+
DONE
51+
0L
52+
> REDISQL.EXEC DB "INSERT INTO foo VALUES ( ... )"
53+
DONE
54+
1L
55+
56+
Now you will like to transfer that same database into a file, so that you can archive it or analyze it.
57+
58+
The first step would be to create another database backed by a file.
59+
60+
61+
> REDISQL.CREATE_DB BACKUP "/home/foo/backup.sqlite"
62+
OK
63+
64+
In this way we have created a new, empty database that is backed by a file.
65+
66+
You will see the small file `home/foo/backup.sqlite`
67+
68+
At this point you just need to make a copy of it.
69+
70+
71+
> REDISQL.COPY DB BACKUP
72+
OK
73+
74+
Now the file `/home/foo/backup.sqlite` will contains all the data that were originally on the `DB` database.
75+
76+
### Load a database
77+
78+
Now, suppose that the data you want to serve via RediSQL are already inside a SQLite database, or suppose that you are recovering from a previous backup. However you would like to have the database in memory, since we know the load will be quite high.
79+
80+
Assuming your database is stored into `/home/foo/recover.sqlite` we start by loading it, and then move it into an in-memory database, and finally we can also delete the database we used for recovering.
81+
82+
83+
> REDISQL.CREATE_DB TO_RECOVER "/home/foo/recover.sqlite"
84+
OK
85+
> REDISQL.CREATE_DB DB
86+
OK
87+
> REDISQL.COPY TO_RECOVER DB
88+
OK
89+
> DEL TO_RECOVER
90+
OK
91+
92+
At this point we have only one database `DB` that is an in-memory one and we have used the `TO_RECOVER` database to load the recovering file.
93+
94+
### Spread load
95+
96+
Another quite interesting use case is about load spreading.
97+
98+
Suppose to have a read-only database `DB1` that makes quite complex and long queries, if that start to be a problem we could spread the load into two identical databases.
99+
100+
101+
> REDISQL.CREATE_DB DB2
102+
OK
103+
> REDISQL.COPY DB1 DB2
104+
OK
105+
106+
Now we have the same dataset in two different database, each one of them with its own thread of execution. This will allow us to round robin between the two databases and achieve smaller latencies.
107+
108+
109+
## End
110+
111+
With this post we showed the newest features of RediSQL.
112+
113+
The product start to be quite stable, more performance test will come in the next release but we don’t plan to touch the API.
114+
115+
If we don’t change the API the next release will be the v1.0.0
116+
117+
As always you can find all the public releases on the [github page][releases], you can openly access the same public release on the [open page of our shop][plaso_open] or you can buy the complete PRO package [signing up in the shop][plaso_signup].
118+
119+
Remember that signing up for the PRO product also provide you free support from us, the creator of the project, so that we can point you to the right direction and suggest the best use cases for our product.
120+
121+
[redisql_copy]: ../references.md#redisqlcopy
122+
[sqlite_cast]: https://www.sqlite.org/lang_expr.html#castexpr
123+
[releases]: https://github.com/RedBeardLab/rediSQL/releases/tag/v0.5.0
124+
[plaso_open]: https://plasso.com/s/epp4GbsJdp-redisql/
125+
[plaso_signup]: https://plasso.com/s/epp4GbsJdp-redisql/signup/

doc/docs/references.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,33 @@ This command is not blocking as well.
266266
4. [`REDISQL.DELETE_STATEMENT`][delete_statement]
267267
5. [Redis Blocking Command][Redis Blocking Command]
268268

269+
## REDISQL.COPY
270+
271+
#### REDISQL.COPY[.NOW] db_key_source db_key_destination
272+
273+
The command copies the source database into the destination database.
274+
275+
The content of the destination databases is completely ignored and lost.
276+
277+
It is not important if the databases are stored in memory or backed by disk, the `COPY` command will work nevertheless.
278+
279+
This command is useful to:
280+
281+
1. Create backups of databases
282+
2. Load data from a slow, disk based, databases into a fast in-memory one
283+
3. To persist data from a in-memory database into a disk based database
284+
4. Initialize a database with a predefined status
285+
286+
Usually the destination database is an empty database just created, while the source one is a databases where we have been working for a while.
287+
288+
This command use the [backup API][backup_api] of sqlite.
289+
290+
**Complexity**: The complexity is linear on the number of page (dimension) of the source database, beware it can be "slow" if the source database is big, during the copy the `source` database is busy and it cannot serve other queries.
291+
292+
**See also**:
293+
294+
1. [Backup API][backup_api]
295+
269296

270297
# Virtual Tables
271298

@@ -393,3 +420,4 @@ This virtual table does not support `INSERT`, `UPDATE` or `DELETE`.
393420
[redis_hash]: https://redis.io/topics/data-types#hashes
394421
[scan]: https://redis.io/commands/scan
395422
[hget]: https://redis.io/commands/hget
423+
[backup_api]: https://www.sqlite.org/backup.html

doc/mkdocs.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ pages:
1818
- "PRO Motivations": pro_motivations.md
1919
-
2020
Blog:
21+
- 'Release 0.7.0': 'blog/release_0.7.0.md'
22+
- 'Release 0.6.0': 'blog/release_0.6.0.md'
23+
- 'Release 0.5.0': 'blog/release_0.5.0.md'
2124
- 'Analytics': 'blog/analytics.md'
2225
- 'JSON on Redis using RediSQL, SQL steroids for Redis': 'blog/JaaS.md'
2326
- 'Double performances of RediSQL going zero copy': 'blog/performances.md'
24-
- 'Release 0.5.0': 'blog/release_0.5.0.md'
25-
- 'Release 0.6.0': 'blog/release_0.6.0.md'

0 commit comments

Comments
 (0)