Skip to content

Pure JavaScript In-Memory Database

7 November 2014

Recently I found Alasql.js – in-memory SQL database available both client and server side (Node.js). It is easy to use:

  • in browser
 <script src="alasql.js"></script>
  • in Node
var alasql = require('alasql');

Supports usual SQL statements, grouping, functions and aggregates. Allows usage of user-defined functions

alasql.userlib.DOUBLE = function(x){return x*2}; 
 db.exec('SELECT a, DOUBLE(a) AS b FROM test1');

Supports promises, …

 db.aexec('SELECT * FROM test').then(function(res){

… parameters, compiled statements and transactions. Has own SQL to JavaScript parser and compiler resulting in nice performance. (tests are available here and here).

Also has limitations but authors state that you should succeed in selecting 1 000 000 records or 2 join two tables by 10 000 records in each.

As the version is 0.0.13 (6th Nov 2014) there are (and probably will be) some bugs. But I’ll keep an eye on this project.

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: