pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joshua D. Drake <jd@commandprompt.com>
To: Mario Splivalo <mario.splivalo@megafon.hr>
Cc: pgsql-performance@postgresql.org
Subject: Re: SELECT INTO large FKyed table is slow
Date: Tue, 30 Nov 2010 17:47:32 -0800
Message-ID: <1291168052.20631.1963.camel@jd-desktop> (raw)
In-Reply-To: <4CF24103.8030209@megafon.hr>
References: <4CF24103.8030209@megafon.hr>

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?

JD

-- 
PostgreSQL.org Major Contributor
Command Prompt, Inc: http://www.commandprompt.com/ - 509.416.6579
Consulting, Training, Support, Custom Development, Engineering
http://twitter.com/cmdpromptinc | http://identi.ca/commandprompt




view thread (32+ messages)  latest in thread

Message-ID: <1291168052.20631.1963.camel@jd-desktop>
Permalink:  ../1291168052.20631.1963.camel@jd-desktop/
Also on:    postgresql.org/message-id/1291168052.20631.1963.camel@jd-desktop

 · 

reply

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: jd@commandprompt.com, mario.splivalo@megafon.hr
  Subject: Re: SELECT INTO large FKyed table is slow
  In-Reply-To: <1291168052.20631.1963.camel@jd-desktop>

* 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