From: Mario Splivalo <mario.splivalo@megafon.hr>
To: jd@commandprompt.com
Cc: pgsql-performance@postgresql.org
Subject: Re: SELECT INTO large FKyed table is slow
Date: Wed, 01 Dec 2010 08:53:46 +0100
Message-ID: <4CF5FF0A.9040605@megafon.hr> (raw)
In-Reply-To: <1291168052.20631.1963.camel@jd-desktop>
References: <4CF24103.8030209@megafon.hr>
<1291168052.20631.1963.camel@jd-desktop>
On 12/01/2010 02:47 AM, Joshua D. Drake wrote:
> On Sun, 2010-11-28 at 12:46 +0100, Mario Splivalo wrote:
>> The database for monitoring certain drone statuses is quite simple:
>>
>
>> This is the slow part:
>> INSERT INTO drones_history (sample_id, drone_id, drone_log_notice,
>> drone_temperature, drone_pressure)
>> SELECT * FROM tmpUpdate;
>>
>> For 100 rows this takes around 2 seconds. For 1000 rows this takes
>> around 40 seconds. For 5000 rows this takes around 5 minutes.
>> For 50k rows this takes around 30 minutes! Now this is where I start lag
>> because I get new CSV every 10 minutes or so.
>
> Have you considered making the foreign key check deferrable?
>
Yes, as Mladen Gogala had advised. No noticable change in performance -
it's still slow :)
But, just for the sake of clarification - I tought that DEFERRABLE would
matter if I do a lot of INSERTs, inside a FOR loop or something like
that. Since I'm doing INSERT INTO ... SELECT, does it makes any difference?
Mario
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: mario.splivalo@megafon.hr, jd@commandprompt.com
Subject: Re: SELECT INTO large FKyed table is slow
In-Reply-To: <4CF5FF0A.9040605@megafon.hr>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox