Analytics using R is often driven from client side applications such as RStudio and generally involves transmission of the large amounts of data from the database server to the clients for analysis. This method of doing the analysis can be slow given the limited resources on database client machines
DB2 is rich with built-in functions. There are simple scalar functions (LENGTH, SQRT, ABS), functions that deal with columns of data and grouping (AVG, SUM, OVER), row functions and specialized statistical functions (CORRELATION, STDDEV).
Why do we have routines in DB2? They allow us to include custom functionality inside our databases. But why do we need them? Should we use them?
Even though DB2 has a very extensive list of built-in functions these functions may not be enough to satisfy a given requirement. In these situations all is not lost. Anyone can incorporate any needed functionality into the database via user-defined functions (UDFs).