I am trying optimizations on my postgresql queries. One of the optimizations I tried was the removal of functions as I have read that functions like COALESCE slow down query