Re: Why is PostgreSQL 9.2 slower than 9.1 in my tests?

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Patryk Sidzina <patryk(dot)sidzina(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Why is PostgreSQL 9.2 slower than 9.1 in my tests?
Date: 2012-12-10 03:53:45
Message-ID: CAMkU=1zcAGKqt36frn8zTytJvta82cM1LAVf2Z0iPfjHLra_Tg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Wed, Dec 5, 2012 at 4:09 AM, Patryk Sidzina <patryk(dot)sidzina(at)gmail(dot)com> wrote:
>
> CREATE TEMP TABLE test_table_md_speed(id serial primary key, n integer);
>
> 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;
>
>
> 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?

Did you just run it once each?

The run-to-run variability in timing can be substantial.

I put the above into a custom file for "pgbench -f sidzina.sql -t 1 -p
$port" and run it on both versions in random order for several hundred
iterations. There was no detectable difference in timing.

Cheers,

Jeff

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Albe Laurenz 2012-12-10 08:57:11 Re: Perform scan on Toast table
Previous Message Jeff Janes 2012-12-08 19:03:27 Re: Any idea on how to improve the statistics estimates for this plan?