Jim Nasby <j...@nasby.net> writes: > Is there any way to have the database tell you if a particular SQL function > can be inlined?
Easiest way is to EXPLAIN a query using it and see if it did get inlined. For example, regression=# create function foo(int) returns int as regression-# 'select $1 + 1' language sql; CREATE FUNCTION regression=# explain verbose select foo(f1) from int4_tbl; QUERY PLAN --------------------------------------------------------------- Seq Scan on public.int4_tbl (cost=0.00..1.06 rows=5 width=4) Output: (f1 + 1) (2 rows) regression=# create function foo2(int) returns int as 'select $1 + 1 limit 1' language sql; CREATE FUNCTION regression=# explain verbose select foo2(f1) from int4_tbl; QUERY PLAN --------------------------------------------------------------- Seq Scan on public.int4_tbl (cost=0.00..2.30 rows=5 width=4) Output: foo2(f1) (2 rows) regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers