> I wrote a blog article about this: Google for "Why is my function > slow?"<http://www.postgresql.org/mailpref/pgsql-general>
Greg, great article. It's funny and humbling how I thought I'd invented the wheel with this workaround, but now it suddenly appears to be common practice. I guess I'm on the right track. I'm curious though-- your examples were plpgsql and you mentioned at the bottom that the plpgsql documentation mentions the one-time plan limitation. Does the same hold true for stored functions in sql? My slow function in this case is written in sql, so I'm guessing the answer is 'yes'.