Hi, I'm with problems about functions. When I execute a select with Function is very slow, and when I execute repeating the code of the existing function inside my SQL is faster. I need to centralize my code, because of that I'm using functions, but is very very slow.. Please how can I use Function and become faster? I need to centralize the SQL
This list is intended for reporting bugs in PostgreSQL. This request for help is not that. Please choose a more appropriate list - pgsql-general@postgresql.org suffices as a catch-all.
That said, you'll likely find improvement by choosing the correct language to write your function in. Namely, choose SQL unless and until you are forced to choose pl/pgsql. As you are simply embedding a single SELECT query you do not use any features that are only present in pl/pgsql.