[HACKERS] Amazing performance failure with SQL function

2009-11-18 Thread Joshua D. Drake
I was just writing a syntical example and wanted to make sure it worked. I found this: CREATE OR REPLACE FUNCTION RETURN_LOTS(INT) RETURNS SETOF INT AS $$ SELECT generate_series(1,$1); $$ COST 0.5 ROWS 1000 SET work_mem TO '5MB' LANGUAGE 'SQL'; postgres=# explain analyze

Re: [HACKERS] Amazing performance failure with SQL function

2009-11-18 Thread Tom Lane
Joshua D. Drake j...@commandprompt.com writes: This is repeatable. I expect a little regression because we have to compile the SQL but 14 seconds? generate_series is a quite efficient C function. I think it's pretty damn good that the overhead of a SQL function on top of that is only 2X. Or