Is there any difference? I know SQL queries are having their execution plans cached just as good as functions.
I foud someone telling:
Performance is an issue, and we suspect query planning might be an underlying cause. I've rewritten the scripts from ad-hoc SQL to a Postgres functions (CREATE FUNCTION) and we saw server load go down quite a bit.
But why?