Re: SQL functions that can be inlined
От | Tom Lane |
---|---|
Тема | Re: SQL functions that can be inlined |
Дата | |
Msg-id | 19899.1289058780@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | SQL functions that can be inlined (Jim Nasby <jim@nasby.net>) |
Список | pgsql-hackers |
Jim Nasby <jim@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
В списке pgsql-hackers по дате отправления: