pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mario Splivalo <mario.splivalo@megafon.hr>
To: Mladen Gogala <mladen.gogala@vmsinfo.com>
Cc: jd@commandprompt.com <jd@commandprompt.com>
Cc: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: SELECT INTO large FKyed table is slow
Date: Wed, 01 Dec 2010 18:00:26 +0100
Message-ID: <4CF67F2A.4070703@megafon.hr> (raw)
In-Reply-To: <4CF678FC.9050003@vmsinfo.com>
References: <4CF24103.8030209@megafon.hr>
	<1291168052.20631.1963.camel@jd-desktop>
	<4CF5FF0A.9040605@megafon.hr>
	<4CF678FC.9050003@vmsinfo.com>

On 12/01/2010 05:34 PM, Mladen Gogala wrote:
> Mario Splivalo wrote:
>>
>>
>> Yes, as Mladen Gogala had advised. No noticable change in performance -
>> it's still slow :)
>>
>
> Declaring constraints as deferrable  doesn't do anything as such, you
> have to actually set the constraints deferred to have an effect. You
> have to do it within a transaction block. If done outside of the
> transaction block, there is no effect:

I understand, I did as you suggested.

Begin; Set constraints all deferred; select my_insert_drones_function(); 
commit


> I was able to insert the same value twice, it only failed at the end of
> the transaction.
>> 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?
>>
> You cannot tell which part takes a long time, select or insert, without
> profiling. I certainly cannot do it over the internet.

If I first select to a dummy temprary table, that SELECT is fast. Just 
INSERT INTO SELECT is slow.

I'll try what Pierre suggested, on whole new filesystem. This one did 
get quite filled with thousands of files that I deleted while the 
database was working.

	Mario



view thread (32+ messages)  latest in thread

Message-ID: <4CF67F2A.4070703@megafon.hr>
Permalink:  ../4CF67F2A.4070703@megafon.hr/
Also on:    postgresql.org/message-id/4CF67F2A.4070703@megafon.hr

 · 

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: mario.splivalo@megafon.hr, mladen.gogala@vmsinfo.com, jd@commandprompt.com
  Subject: Re: SELECT INTO large FKyed table is slow
  In-Reply-To: <4CF67F2A.4070703@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