func() & select func()
От | Hiroshi Inoue |
---|---|
Тема | func() & select func() |
Дата | |
Msg-id | 000901c01322$e6bf81e0$2801007e@tpf.co.jp обсуждение исходный текст |
Ответы |
Re: func() & select func()
|
Список | pgsql-hackers |
Hi all, I have seen discussions about iscachable attribute of functions. Now I'm confused to see a solution in 6.5 (by Shigeru Matsumoto). =# explain select * from pg_class where oid=1259; Index Scan using pg_class_oid_index on pg_class (cost=0.00..2.01rows=1 width=92) 1) Using non-cachable function f() =# create function f(oid) returns oid as ' select $1; ' language 'sql'; =# explainselect * from pg_class where oid=f(1259); Seq Scan on pg_class (cost=0.00..3.17 rows=1 width=92) Seems reasonable. 2) Using select f() =# explain select * from pg_class where oid=(select f(1259)); Index Scan using pg_class_oid_index on pg_class (cost=0.00..2.01rows=1 width=92) InitPlan -> Result (cost=0.00..0.00rows=0 width=0) This is the result in my current environment. Hmm,what's the difference between 1) and 2) ? Regards. Hiroshi Inoue
В списке pgsql-hackers по дате отправления: