3 ms·
> plpgsql is somewhat gnarly, but it is well adapted for the database. You can use python or perl to define your postgres functions. https://www.postgresql.or
by arkh 8y ago
> plpgsql is somewhat gnarly, but it is well adapted for the database.
You can use python or perl to define your postgres functions.
https://www.postgresql.org/docs/10/static/plpython-funcs.html https://www.postgresql.org/docs/10/static/plpython-funcs.htm...
- rleigh 8y agoThey are slower (by orders of magnitude) than writing them in C or C++, or even PL/pgSQL. Calling into the interpreter for millions of trigger events can quickly become a major bottleneck. When I originally implemented https://pgxn.org/dist/debversion/ https://pgxn.org/dist/debversion/ for version numbering, I originally implemented it in Perl, then Python. The implementations were clean, but the performance of both was abysmal. After reimplementing it in C++ with a C interface, it runs like greased lightning. While this is a custom datatype with operators implemented as C functions, the same concerns apply to triggers which are invoked on every affected row.