Why is PostgreSQL 9.2 slower than 9.1 in my tests?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have upgraded from PostgreSQL 9.1.5 to 9.2.1:

    "PostgreSQL 9.1.5 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.4.6 20120305 (Red Hat 4.4.6-4), 64-bit"
    "PostgreSQL 9.2.1 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.4.6 20120305 (Red Hat 4.4.6-4), 64-bit"

It is on the same machine with default PostgreSQL configuration files (only port was changed).

For testing purpose I have simple table:

    CREATE TEMP TABLE test_table_md_speed(id serial primary key, n integer);


Which I test using function:

CREATE OR REPLACE FUNCTION TEST_DB_SPEED(cnt integer) RETURNS text AS $$
DECLARE
time_start timestamp;
time_stop timestamp;
time_total interval;
BEGIN
time_start := cast(timeofday() AS TIMESTAMP);
FOR i IN 1..cnt LOOP
INSERT INTO test_table_md_speed(n) VALUES (i);
END LOOP;
time_stop := cast(timeofday() AS TIMESTAMP);
time_total := time_stop-time_start;

RETURN extract (milliseconds from time_total);
END;
$$ LANGUAGE plpgsql;

And I call:

SELECT test_db_speed(1000000);

I see strange results. For PostgreSQL 9.1.5 I get "8254.769", and for 9.2.1 I get: "9022.219". This means that new version is slower. I cannot find why.

Any ideas why those results differ?

-- 
Patryk Sidzina

[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux