Jeff Janes <jeff.janes@xxxxxxxxx> writes: > On Tue, Dec 11, 2012 at 2:50 AM, Patryk Sidzina > <patryk.sidzina@xxxxxxxxx> wrote: >> The differences come up when you change the "INSERT" to "EXECUTE 'INSERT'" ( >> and i checked this time on 3 machines, one of which was Windows): >> FOR i IN 1..cnt LOOP >> EXECUTE 'INSERT INTO test_table_md_speed(n) VALUES (' || i || ')'; >> END LOOP; > The culprit is the commit below. I don't know exactly why this slows > down your case. A preliminary oprofile analysis suggests that it most > of the slowdown is that it calls AllocSetAlloc more often. I suspect > that this slow-down will be considered acceptable trade-off for > getting good parameterized plans. I'm having a hard time getting excited about optimizing the above case: the user can do far more to make it fast than we can, simply by not using EXECUTE, which is utterly unnecessary in this example. Having said that, though, it's not real clear to me why the plancache changes would have affected the speed of EXECUTE at all --- the whole point of that command is we don't cache a plan for the query. regards, tom lane -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance