I wrote: > But wait: HEAD takes > Time: 6632.709 ms (00:06.633) > to do the same thing. So somehow the new-style SQL function > stuff is very materially slower in this use-case, with or > without this patch. I do not understand why.
"perf" tells me that in the fx3 test, a full third of the runtime is spent inside stringToNode(), with about three-quarters of that going into pg_strtok(). This makes no sense to me: we'll be reading the prosqlbody of fx3(), sure, but that's not enormously long (about 1200 bytes). And pg_strtok() doesn't look remarkably slow. There's no way this should be taking more time than raw parsing + parse analysis, even for such a trivial query as "select $1 + $1". There's been some talk of getting rid of our existing nodetree storage format in favor of something more efficient. Maybe we should put a higher priority on getting that done. But anyway, that seems orthogonal to the current patch. > Even without cross-query plan caching, I don't see why the > patch isn't better than it is. It ought to be at least > competitive with the unpatched code. This remains true. regards, tom lane