PL/Lua: Lua as a loadable procedural language for Postgres

tosh | 119 points

Except don’t use this one.

It’s buggy and forgotten.

Use:

https://github.com/pllua/pllua-ng

Rewritten, much better and actually updated.

usgroup | 6 years ago

If you want a modern version of this, you should checkout https://github.com/RhodiumToad/pllua-ng

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

xdanger | 6 years ago

Looking at these great PL* languages makes me wonder if it would be feasible to use something like GraalVM to write PL functions in R/Java/JS/etc.

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.

jarym | 6 years ago

For interest, here a post that show a quick comparison of PLPGSQL, PLLua & PLV8 https://www.newfies-dialer.org/using-lua-in-postgresql-pllua...

areski | 6 years ago

This looks really cool--reminds me of the capabilities of Redis with Lua scripts. Does anyone know how it compares to PLV8 (https://github.com/plv8/plv8)?

jihadjihad | 6 years ago

This is neat. Anyone know of any functional languages that would integrate with Postgres?

pmarreck | 6 years ago

On a game I worked on, we used little snippets of lua in our UI for both labels and property values (as well as our scripting language). It was very akin to working with something like HTML+JS. Super convenient.

a_t48 | 6 years ago

That's interesting. For somebody who's not all that familiar with Lua, what are it's main selling points for something like this?

brightball | 6 years ago