[PERFORM] Most effective insert or replace

2009-07-03 Thread Sergei Politov
Hi, As far as I recall postgres does not have built-in support for "insert or replace" feature. But there is a lot of ways to obtain the same result. The problem is that performance of these techniques is quite bad. It is about two times slower than simple insert. I tried the following

Re: [PERFORM] - Slow Query

2009-07-03 Thread Віталій Тимчишин
2009/7/1 Mike Ivanov > > > > LEFT outer JOIN ville ON ville.uid = bien.ref_ville > > LEFT outer JOIN freguesia_ville ON freguesia_ville.ref_ville =ville.uid > > This is not enough. You have to add this condition as well: > > AND bien.ref_ville = freguesia_ville.ref_ville > > In other words, when

Re: [PERFORM] Most effective insert or replace

2009-07-03 Thread Matthew Wakeling
On Fri, 3 Jul 2009, Sergei Politov wrote:   As far as I recall postgres does not have built-in support for "insert or replace" feature.   Please comment these ways and propose effective ways to simulate "insert or replace" behavior.   Also in may case I'm making a lot of inserts in a batch.

Re: [PERFORM] - Slow Query

2009-07-03 Thread Віталій Тимчишин
Sorry, it was an error in previous letter. 3 липня 2009 р. 14:22 Віталій Тимчишин написав: > > > 2009/7/1 Mike Ivanov > >> >> >> > LEFT outer JOIN ville ON ville.uid = bien.ref_ville >> > LEFT outer JOIN freguesia_ville ON freguesia_ville.ref_ville =ville.uid >> >> This is not enough. You have