Re: How long should it take to insert 200,000 records? - Mailing list pgsql-performance

From Tom Lane
Subject Re: How long should it take to insert 200,000 records?
Date
Msg-id 29362.1170817637@sss.pgh.pa.us
Whole thread Raw
In response to Re: How long should it take to insert 200,000 records?  ("Karen Hill" <karen_hill22@yahoo.com>)
List pgsql-performance
"Karen Hill" <karen_hill22@yahoo.com> writes:
> On Feb 5, 9:33 pm, t...@sss.pgh.pa.us (Tom Lane) wrote:
>> I think you have omitted a bunch of relevant facts.

> The postgres version is 8.2.1 on Windows.   The pl/pgsql function is
> inserting to an updatable view (basically two tables).
> [ sketch of schema ]

I think the problem is probably buried in the parts you left out.  Can
you show us the full schemas for those tables, as well as the rule
definition?  The plpgsql function itself can certainly go a lot faster
than what you indicated.  On my slowest active machine:

regression=# create table viewfoo(x int);
CREATE TABLE
regression=# CREATE OR REPLACE FUNCTION functionFoo() RETURNS VOID AS $$
BEGIN
FOR i in 1..200000 LOOP
INSERT INTO viewfoo (x) VALUES (i);
END LOOP;
END;
$$ LANGUAGE plpgsql;
CREATE FUNCTION
regression=# \timing
Timing is on.
regression=# select functionFoo();
 functionfoo
-------------

(1 row)

Time: 16939.667 ms
regression=#

            regards, tom lane

pgsql-performance by date:

Previous
From: Mark Kirkwood
Date:
Subject: Re: How long should it take to insert 200,000 records?
Next
From: "Muruganantham M"
Date:
Subject: Help Needed