3

I am trying to use PostgreSQL for a financial system and I need the best performance I can use, so I decided to use stored procedures for managing all the math and logic of the system. I have read that luajit have performance similar to C but without the "dangers" of using C.

Fortunately PostgreSQL has lua as one of its procedural languages but I don't know if this pl/lua is luajit or only lua (and therefore the performance associated to them).

So if PostgreSQL uses lua performance I would use pl/v8 instead but if pl/lua uses luajit I will stay with pl/lua.

tinlyx
3,84014 gold badges50 silver badges79 bronze badges
asked May 13, 2015 at 15:40

1 Answer 1

4

According to Luis Carvalho, one of the developers of PL/Lua, PL/Lua can use LuaJIT.

However, you may find there are many more factors which affect the overall performance of the PL code you write, including the overhead of the language's bindings in PostgreSQL, data type conversions, familiarity of your developers with Lua vs. other languages and their ability to write performant code, and many more. There's some more discussion about performance of the PLs you may find interesting.

PL/Lua did do well in a benchmark done by Pavel Stehule.

answered May 13, 2015 at 16:56
2
  • Thank you so much for the links. I am not sure how can I use LuaJIT, I have to import something?, install something? How can I tell if I am using LuaJIT instead of Lua? Commented May 19, 2015 at 3:06
  • I'm not sure I can help much in installation procedures, but there's an example in the PL/Lua documentation under "Anonymous blocks" doing local ffi = assert(require("ffi")); -- LuaJIT which AFAICT would ensure you are actually using LuaJIT. Commented May 19, 2015 at 17:15

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.