From: | Greg Stark <gsstark(at)mit(dot)edu> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Batch Insert Performance |
Date: | 2002-12-19 00:41:12 |
Message-ID: | 87ptry3knr.fsf@stark.dyndns.tv |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I'm trying to seed a database and I'm surprised by how slow it is. I'm doing a
query like:
INSERT INTO source_other_xref (source_id, other_id) (
SELECT source_id,1+trunc(1000*random())
FROM source_table
);
where source_table has 271,000 records. Table source_other_xref has two
columns both of which are foreign key references, one to source_table and the
other to another table.
It's been running for hours and hours.
The machine doesn't seem to be thrashing its disk writing or reading much. It
seems to be completely cpu-bound.
I'm thinking it's mostly wasting time checking the foreign key constraint. Is
there any equivalent to Oracle's ability to "disable" a constraint and then
reenable it later?
Even with the foreign key constraints I wouldn't have expected inserting 200k
records to take this long.
--
greg
From | Date | Subject | |
---|---|---|---|
Next Message | Ian Harding | 2002-12-19 00:43:01 | Re: Regarding select distinct ...query |
Previous Message | Greg Stark | 2002-12-19 00:12:40 | Re: Regarding select distinct ...query |