While using perl to make some DBI calls to a PostgreSQL database, I realized that many's the time when I select data from a view, or use a function/stored procedure. Naturally, the functions/SPs are in SQL or PL/pgSQL, and the selection and final presentation of the data is handled by perl. Now, with some new advances in PL/Perl, -- a perl-based procedural language for PostgreSQL -- I started to think about Where Things Are Done.
Correlated subqueries lend themselves nicely to being rewritten into functions/SPs using PL/pgSQL, rather than downloading messy blocks of data into memory only to be subsequently discarded.
Regular expression processing is loved by perl. So perl might be used for data validation -- implemented in PL/Perl as a trigger, thereby letting the database handle the atomicity of the transaction; rather than validating in perl, using DBI to insert, using PL/pgSQL to verify, and then possibly roll the whole thing back across a span of different languages and routines.
It appears that where things are done is becoming less of a restriction and more of a personal choice, based on a number of factors unique to the individual problem domain's specific solution criteria.
So, which method/s would you use?
And why?
Contemplatively,In reply to Perl, PostgreSQL, and Where Things Are Done by Velaki
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |