If you want a more complicated transform on lots of data your fancy sql won’t help.
It's also graph analysis and ML models.
ML models - I already mentioned how to uplift R and Python functions to SQL function. even if you are not using PostgreSQL many other databases help you with uplifting and interfacing with existing ML libraries through FFI