PL/Lua: Lua as a loadable procedural language for Postgres
github.com
github.com
It’s buggy and forgotten.
Use:
https://github.com/pllua/pllua-ng
Rewritten, much better and actually updated.
A friend of mine benchmarked different pl languages and https://github.com/eugwne/pllj was basically the fastest, but it's not so actively maintained. pllua-ng with luajit 2.1 was also faster than plv8. But that was about two years ago, your milage may vary.
"Lua is faster - PL/V8 is lightly faster than Python, but Lua is about 30% faster than PL/V8" - Pavel Stěhule and that was without luajit, but 4 years ago.
Maybe someone should build a benchmark :D
https://github.com/RhodiumToad/pllua-ng https://github.com/pllua/pllua-ng
Oracle DB supports this already (it seems, I've not tried it): https://www.graalvm.org/docs/examples/mle-oracle/ ) - and the advantage of Graal is it supports a wide range of languages and can output native binaries.
There is only one container type: the table. There is only one number type. (Since 5.3 Lua internally uses 2: ints and doubles, but that’s an implementation detail.) etc.
2. Lua is easy to integrate.
3. It’s easy to set up a sandboxed environment with Lua.
4. Lua is surprisingly fast, especially considering it is interpreted and dynamic.
For instance, if you had a field that you wanted to be the output of some complex expression, algorithm, &c, you can write it as a function. For instance, something like Greatest Common Divisor (GCD) or geometry functions (e.g. intersection of two geometries, the union or intersection of two geometries, &c). Another example is custom aggregate functions.
This just lets you do it in Lua, if that's your thing. I think by default there is PL/pgSQL, PL/Tcl, PL/Perl , and PL/Python. There are plugins for a variety of other languages (e.g. ruby, java lua, R). I actually thought Lua became a default recently, but maybe they're still talking about it.
I played around with PL/Lua 5 or 6 years ago, and liked it, but the project/idea got sidelined for other reasons so I never got very deep into it.
I worked for a shop in the late 00's and early 10's that had Very Big Database Servers doing several hundred million transactions per second (100+ core, multiple RAMSan, etc. type bare metal servers), and stored procs were the way the go. They were basically the interface layer to the data, and it allowed us to keep the interface (or even version it) but change how access happened behind the scenes, like splitting a table into partitions, or replacing a bad performing query with a differently structured one that did better, which made it a non-concern for the frontend code that was responsible for getting data and formatting it, and didn't really care about _how_ that data was retrieved.
I think it might be the current state of version control tooling that's in the way here. It can be a tricky and often fairly manual process to sync database changes (even just running the migrate command) when releases are tied to git repos.
That's not to say git repos aren't wonderful, but I see underutilization of database functionality as a subtle downside.
There were things that were neat. But a lot of it came from the head-scratch-inducing genus of genius.