dynamic SQL - possible performance regression in 9.2 - Mailing list pgsql-hackers

From Pavel Stehule
Subject dynamic SQL - possible performance regression in 9.2
Date
Msg-id CAFj8pRCKfoz6L82PovLXNK-1JL=jzjwaT8e2BD2PwNKm7i7KVg@mail.gmail.com
Whole thread Raw
Responses Re: dynamic SQL - possible performance regression in 9.2
List pgsql-hackers
Hello

I rechecked performance of dynamic SQL and it is significantly slower
in 9.2 than 9.1

-- 9.1
postgres=# create or replace function test() returns void as $$ begin
for i in 1..1000000 loop execute 'select 1'; end loop; end $$ language
plpgsql;
CREATE FUNCTION
postgres=# \timing
Timing is on.
postgres=# select test();test
------

(1 row)

Time: 7652.904 ms
postgres=# select test();test
------

(1 row)

Time: 7828.025 ms

-- 9.2
postgres=# create or replace function test() returns void as $$ begin
for i in 1..1000000 loop execute 'select 1'; end loop; end $$ language
plpgsql;
CREATE FUNCTION
Time: 59.272 ms
postgres=# select test();test
------

(1 row)

Time: 11153.646 ms
postgres=# select test();test
------

(1 row)

Time: 11081.899 ms

This test is synthetic, but it shows so somebody who use dynamic SQL
in triggers (for partitioning) can has slower operations.



pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: Proposal: Store "timestamptz" of database creation on "pg_database"
Next
From: Heikki Linnakangas
Date:
Subject: Re: pg_basebackup from cascading standby after timeline switch