First inserts are faster than second ones - Mailing list pgsql-general

From AlannY
Subject First inserts are faster than second ones
Date
Msg-id 6b5a9169c298317d55cd427f479bf724@imap.hc.ru
Whole thread Raw
List 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.

pgsql-general by date:

Previous
From: "Daniel Verite"
Date:
Subject: Re: Comparison of Oracle and PostgreSQL full text search
Next
From: Gary Fu
Date:
Subject: Re: psql problem