
MySQL is NoSQL!
MySQL, as you know, has two drawbacks *. First, the query language is SQL. This is fixed with the help of HandlerSocket, about which there were already articles on the hub Secondly, it has no built-in javascript.
* - in fact, this is a joke. MySQL is unlikely to have exactly two shortcomings, but they are also completely different from what I wrote. and the lack of javascript is, of course, not a flaw. however, if we imagine that MySQL does not have an SQL interface at all, then we will have to compare it (as a NoSQL solution), in particular, with MongoDB, in which there is a javascript interpreter.
So, I started work in the second direction and already got some result:

At the moment, you can do the following:
They passed the expression, it was executed and returned the result.
Similarly: made a function, called it, returned the result from the function.
Here we (1) initialize the global object with something, (2) indicate the name of the function to be called, (3 - ...) call it with these parameters. Why is this needed?
Here's why: once we create a global object, once we create a function there, but we call the function several times already and with different parameters.
As many have already guessed, 0.08 seconds is the initialization time of the V8. Naturally, it is possible and necessary to initialize V8 not once for each request, but once for each thread, or somehow even more cunningly.
look at
TODO LIST sources :
1. error handling / stability. now with syntax errors everything crashes.
2. less initialize the V8 interpreter
3. mysql_find - NoSQL interface to the contents of MySQL databases. here I am still dealing with locks and transactions. for example, should all operations be performed within a single transaction, or should one operation be a single transaction? or give a read-only interface in general?
I will be glad to comments and suggestions.
* - in fact, this is a joke. MySQL is unlikely to have exactly two shortcomings, but they are also completely different from what I wrote. and the lack of javascript is, of course, not a flaw. however, if we imagine that MySQL does not have an SQL interface at all, then we will have to compare it (as a NoSQL solution), in particular, with MongoDB, in which there is a javascript interpreter.
So, I started work in the second direction and already got some result:

At the moment, you can do the following:
mysql> select execute_js ("10 + 30") as r; + ---- + | r | + ---- + | 40 | + ---- + 1 row in set (0.08 sec)
They passed the expression, it was executed and returned the result.
mysql> select execute_js ("function f (x) {return x + 20;}; f (30)") as r; + ---- + | r | + ---- + | 50 | + ---- + 1 row in set (0.08 sec)
Similarly: made a function, called it, returned the result from the function.
mysql> select execute_js ("function func (x) {return x * 1 + 10;}", "func", "20") as r; # description see below + ---- + | r | + ---- + | 30 | + ---- + 1 row in set (0.08 sec) mysql> select execute_js ("require ('/ tmp / func.js')", "func", "30") as r; # description see below + ---- + | r | + ---- + | 40 | + ---- + 1 row in set (0.08 sec)
Here we (1) initialize the global object with something, (2) indicate the name of the function to be called, (3 - ...) call it with these parameters. Why is this needed?
mysql> select execute_js ("require ('/ tmp / func.js');", "func", CONCAT (num.i, "")) as r from num; + ---- + | r | + ---- + | 11 | | 12 | | 13 | | 13 | | 15 | | 16 | | 16 | | 16 | | 19 | | 19 | | 19 | | 20 | + ---- + 12 rows in set (0.08 sec)
Here's why: once we create a global object, once we create a function there, but we call the function several times already and with different parameters.
As many have already guessed, 0.08 seconds is the initialization time of the V8. Naturally, it is possible and necessary to initialize V8 not once for each request, but once for each thread, or somehow even more cunningly.
look at
TODO LIST sources :
1. error handling / stability. now with syntax errors everything crashes.
2. less initialize the V8 interpreter
3. mysql_find - NoSQL interface to the contents of MySQL databases. here I am still dealing with locks and transactions. for example, should all operations be performed within a single transaction, or should one operation be a single transaction? or give a read-only interface in general?
I will be glad to comments and suggestions.