title: PostgreSQL Inline Function Behavior
body: <p>I wonder if anybody can please confirm the expected behavior of PostgreSQL Inlining?</p>
  
  <p>From the Microsoft SQL world, any function which is determined to be inline, will be used in a single iteration over a number of lines (The function body is essentially injected into the caller statement, making it set-based [One call] instead of a probe per input row of data [Many calls]).</p>
  
  <p>My team and I were battling to prove this without a Profiler such as in MSSQL, but we were able to prove that eventually and found that the number of iterations on our function we think is inline is directly proportional to the number of rows over which it operates.</p>
  
  <p>We did so by introducing an intentional wait in the function (pg_sleep) where we can see that a wait of N seconds leads to a total execution time of Rows*N, i.e. over an input of 6 rows, waiting 1 second is 6 seconds, waiting 2 is 12 and so on.</p>
  
  <p>So our questions are:</p>
  
  <ol>
  <li>Is inlining in PostgreSQL what we think it is (Equivalent to MSSQLs Inline function [Type='IF'])?</li>
  <li>Is there a profiling tool which is able to show this clearly, like Profiler in MSSQL is able to?</li>
  <li>Are there any meta-data markers we can look at to confirm/deny that our function is indeed inline-able?</li>
  </ol>