First inserts are faster than second ones

From: AlannY <m(at)alanny(dot)ru>
To: <pgsql-general(at)postgresql(dot)org>
Subject: First inserts are faster than second ones
Date: 2010-07-28 13:23:50
Message-ID: 6b5a9169c298317d55cd427f479bf724@imap.hc.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi there.

I have a strange behaviour about INSERT execution. I have very dummy
PL/pgSQL function, which SELECT data from table; if data exists - skip, if
not - add one. It's about 3'000'000 execution per program life.

Everything works. But there are one weird thing. After DROP TABLE and then
CREATE TABLE (CREATE INDEX), it's must faster to work for this function.
After initial INSERTs the speed of execution about 5 minutes. But,
transaction may fail. If it fail, I can change data and run this function
from the beginning. The second pass on the empty tables are much slower,
about 1,5 hours. So, I decide to DROP TABLE and CREATE it again and gain
much speedup.

Is it normal?

Thanks for patience.

Browse pgsql-general by date

  From Date Subject
Next Message Gary Fu 2010-07-28 13:26:05 Re: psql problem
Previous Message Greg Smith 2010-07-28 12:21:03 Re: psql problem