Plv8 disadvantages or limitations?

I play with PLV8 to record triggers and stored procedures for PostgreSQL. So far, I do not see any flaws compared to PLPGSQL. Especially if working with JSON seems even smarter than PLPGSQL. Are there any disadvantages or limitations to using PLV8? Could PLV8 be a complete replacement for PLPGSQL? It would be great if someone could share their experiences on this.

+5
source share
2 answers

The advantages and disadvantages of PLV8 are the same as the advantages and disadvantages of PLPerl, PLPython, and other PL languages.

  • It is not integrated with the PostgreSQL engine - the result of processing SQL queries may be slower. PLpgSQL is fully integrated into the PostgreSQL engine.
  • SQL is not integrated into the language - it is not possible to perform static analysis of embedded SQL. This is possible with PLpgSQL - see Plpgsql_check.
  • You can do more expensive mathematical calculations, manipulating strings and arrays is usually faster than in PLpgSQL.
  • You can use libraries designed for languages ​​- Perl - CPAN, ...
  • JavaScript, Perl, Python are common languages, so any common tasks are performed well there.
  • PLpgSQL is a mature language for manipulating data in a database environment. Almost everything that developers need to work with data is. Iterating over the result, taking data from the database requires less readable code.

PLpgSQL is an ideal language for processing data using SQL. Other PLs are better for anything else - IO, Network, custom formatting, slow numerical computing, ...

+8
source

A bit late, but you cannot kill the request at the moment running the plv8 script, the only way is to restart the entire postgresql server. This is a huge flaw, and our team is thinking of porting to PLpgPython.

0
source

All Articles