<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">FYI, The conversation about our inlining problem is live again.<div class=""><br class=""></div><div class=""><a href="https://www.postgresql.org/message-id/10355.1540926295@sss.pgh.pa.us" class="">https://www.postgresql.org/message-id/10355.1540926295@sss.pgh.pa.us</a></div><div class=""><br class=""></div><div class="">I raised our issues with both Tom and Andres, and also our tentative solution of just marking functions we wanted to inline as INLINE. Unsurprisingly, neither of them was super excited to add syntax to solve what they see as an implementation problem. Fortunately, Tom has brushed off his thoughts around fixing value caching behaviour so that more aggressive inlining behaviour becomes a reasonable default, which solves our problem as a side effect to a general improvement to PgSQL efficiency.</div><div class=""><br class=""></div><div class="">(side note on WTF I’m talking about:</div><div class=""><br class=""></div><div class="">In a query with repeated terms on the target list:</div><div class=""><br class=""></div><div class="">SELECT myfunc(this), myfunc(this), that FROM mytable</div><div class=""><br class=""></div><div class="">The return value of myfunc will be calculated twice. That’s, clearly, not an efficient thing to do. This is why the inlining logic, when presented with a function that does something like:</div><div class=""><br class=""></div><div class="">myfunc(this) -> select func2($1) and func2($1)</div><div class=""><br class=""></div><div class="">will say, if func2 is costly, “nope, not going to inline that, it causes a double calculation!”. If the handling of repeated function calls on the target list was smarter, the inliner could accept the above case, and we’d be happy campers.</div><div class=""><br class=""></div><div class="">end side note)</div><div class=""><br class=""></div><div class="">Anyways, keep an eye on that thread, and see if you can understand it :)</div><div class=""><br class=""></div><div class="">ATB,</div><div class="">P</div></body></html>