IMMUTABLE break inlining simple SQL functions.

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема IMMUTABLE break inlining simple SQL functions.
Дата
Msg-id 162867790908020525q102b4b91o1d7110f49824ecb6@mail.gmail.com
обсуждение исходный текст
Ответы Re: IMMUTABLE break inlining simple SQL functions.  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hello

I though, so simple SQL functions should be inlined everywhere. When I
tested sample for recent discussion, I found so immutable flag breaks
inlining.

Is it bug?

postgres=# create or replace function foo(a int) returns int as $$
select $1+1$$ language sql STRICT IMMUTABLE;
CREATE FUNCTION
Time: 2,723 ms
postgres=# SELECT * FROM pg_stat_user_functions ;funcid | schemaname | funcname | calls | total_time | self_time
--------+------------+----------+-------+------------+----------- 16450 | public     | foo      |     3 |          0 |
      0
 
(1 row)

postgres=# SELECT foo(10);foo
----- 11
(1 row)
funcid | schemaname | funcname | calls | total_time | self_time
--------+------------+----------+-------+------------+----------- 16450 | public     | foo      |     4 |          0 |
      0
 
(1 row)

postgres=# create or replace function foo(a int) returns int as $$
select $1+1$$ language sql STRICT;
CREATE FUNCTION
Time: 3,716 ms
postgres=# SELECT foo(11);foo
----- 12
(1 row)

Time: 1,611 ms
postgres=# SELECT * FROM pg_stat_user_functions ; funcid | schemaname
| funcname | calls | total_time | self_time
--------+------------+----------+-------+------------+----------- 16450 | public     | foo      |     4 |          0 |
      0
 
(1 row)

regards
Pavel Stehule


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Joe Conway
Дата:
Сообщение: Re: [PATCH] Implement (and document, and test) has_sequence_privilege()
Следующее
От: Robert Haas
Дата:
Сообщение: Re: ALTER TABLE ... ALTER COLUMN ... SET DISTINCT