Seref Arikan <serefarikan@kurumsalteknoloji.com> writes:
> I've just noticed that some parts of the autogenerated queries can be
> functions on their own. Would moving these parts to their own functions
> help the query planner?
It's difficult to answer that without a lot more detail than you've
provided, but my offhand guess would be "no". Usually it's better
when the planner can expand functions inline, which would just be
reversing the transformation you're thinking of.
regards, tom lane