I said:
> [hmm, I wonder why plpgsql seems to have gotten slower in 7.4...]
False alarm --- or at least, it wasn't plpgsql's fault. I copied Joe's
function definition, which was
CREATE OR REPLACE FUNCTION public.locate(bpchar, bpchar) RETURNS int4 AS '
But since position() takes arguments of type TEXT, there are two
bpchar->text coercions involved inside the function. This was a "free"
binary coercion in 7.3, but 7.4 interprets it as invoking rtrim().
The extra rtrim operations account for most of the slowdown.
Using functions declared like "locate(text, text)" to avoid the unwanted
type coercions, I get these kinds of numbers:
7.4 7.3
position() 1 usec/call 1 usec/call
SQL func 1 usec/call 90 usec/call
plpgsql func 110 usec/call 100 usec/call
regards, tom lane