Re: How long should it take to insert 200,000 records?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Karen Hill" <karen_hill22(at)yahoo(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: How long should it take to insert 200,000 records?
Date: 2007-02-07 03:07:17
Message-ID: 29362.1170817637@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

"Karen Hill" <karen_hill22(at)yahoo(dot)com> writes:
> On Feb 5, 9:33 pm, t(dot)(dot)(dot)(at)sss(dot)pgh(dot)pa(dot)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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Muruganantham M 2007-02-07 14:15:02 Help Needed
Previous Message Mark Kirkwood 2007-02-07 02:41:34 Re: How long should it take to insert 200,000 records?