Re: slow commits with heavy temp table usage in 8.4.0 - Mailing list pgsql-hackers

From Tom Lane
Subject Re: slow commits with heavy temp table usage in 8.4.0
Date
Msg-id 28632.1249502537@sss.pgh.pa.us
Whole thread Raw
In response to slow commits with heavy temp table usage in 8.4.0  ("Todd A. Cook" <tcook@blackducksoftware.com>)
Responses Re: slow commits with heavy temp table usage in 8.4.0  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
List pgsql-hackers
"Todd A. Cook" <tcook@blackducksoftware.com> writes:
> I've noticed that on 8.4.0, commits can take a long time when a temp table is repeatedly
> filled and truncated within a loop.  A very contrived example is

Hmm.  I tweaked the function to allow varying the number of truncates:

regression=# begin;
BEGIN
Time: 1.037 ms
regression=# select commit_test_with_truncations(10000) ;commit_test_with_truncations 
------------------------------
(1 row)

Time: 9466.060 ms
regression=# commit;
COMMIT
Time: 1095.946 ms
regression=# begin;
BEGIN
Time: 1.002 ms
regression=# select commit_test_with_truncations(30000) ;commit_test_with_truncations 
------------------------------
(1 row)

Time: 93492.874 ms
regression=# commit;
COMMIT
Time: 3184.248 ms

The commit time doesn't seem tremendously out of line, but it looks
like there's something O(N^2)-ish in the function execution.  Do
you see a similar pattern?  With so many temp files there could well
be some blame on the kernel side.  (This is a Fedora 10 box.)
        regards, tom lane


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: GRANT ON ALL IN schema
Next
From: Pavel Stehule
Date:
Subject: Re: GRANT ON ALL IN schema