pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Yves Vindevogel <yves.vindevogel@implements.be>
To: pgsql-performance@postgresql.org
Subject: Re: Insert performance (OT?)
Date: Tue, 19 Jul 2005 10:35:15 +0200
Message-ID: <3508d984c33d87fd74c90913aaa24c4d@implements.be> (raw)
In-Reply-To: <b201f08ef88897bc4ad87631fda3d877@implements.be>
References: <b201f08ef88897bc4ad87631fda3d877@implements.be>

nobody ?

On 18 Jul 2005, at 21:29, Yves Vindevogel wrote:

> Hi,
>
> Suppose I have a table with 4 fields (f1, f2, f3, f4)
> I define 2 unique indexes u1 (f1, f2, f3) and u2 (f1, f2, f4)
>
> I have 3 records
> A, B, C, D (this will be inserted)
> A, B, C, E (this will pass u2, but not u1, thus  not inserted)
> A, B, F, D (this will pass u1, but not u2, thus not inserted)
>
> Now, for performance ...
>
> I have tables like this with 500.000 records where there's a new 
> upload of approx. 20.000 records.
> It is only now that we say index u2 to be necessary.  So, until now, I 
> did something like insert into ... select f1, f2, f2, max(f4) group by 
> f1, f2, f3
> That is ok ... and also logically ok because of the data definition
>
> I cannot do this with 2 group by's.  I tried this on paper and I'm not 
> succeeding.
>
> So, I must use a function that will check against u1 and u2, and then 
> insert if it is ok.
> I know that such a function is way slower that my insert query.
>
> So, my question ...
> How can I keep the same performance, but also with the new index in 
> mind ???
>
>
> Met vriendelijke groeten,
> Bien à vous,
> Kind regards,
>
> Yves Vindevogel
> Implements
>
> <Pasted Graphic 2.tiff>
>
> Mail: yves.vindevogel@implements.be  - Mobile: +32 (478) 80 82 91
>
> Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76
>
> Web: http://www.implements.be
>
> First they ignore you.  Then they laugh at you.  Then they fight you.  
> Then you win.
> Mahatma Ghandi.
> ---------------------------(end of 
> broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>
Met vriendelijke groeten,
Bien à vous,
Kind regards,

Yves Vindevogel
Implements


Mail: yves.vindevogel@implements.be  - Mobile: +32 (478) 80 82 91

Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76

Web: http://www.implements.be

First they ignore you.  Then they laugh at you.  Then they fight you.  
Then you win.
Mahatma Ghandi.

Attachments:

Pasted Graphic 2.tiff (image/tiff, 5.6K) download view image

view thread (8+ messages)  latest in thread

Message-ID: <3508d984c33d87fd74c90913aaa24c4d@implements.be>
Permalink:  ../3508d984c33d87fd74c90913aaa24c4d@implements.be/
Also on:    postgresql.org/message-id/3508d984c33d87fd74c90913aaa24c4d@implements.be

 · 

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: yves.vindevogel@implements.be
  Subject: Re: Insert performance (OT?)
  In-Reply-To: <3508d984c33d87fd74c90913aaa24c4d@implements.be>

* 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