Re: [HACKERS] update/insert,

2006-07-05 Thread Joshua D. Drake
> > Which is faster will probably depends on what is more common in your DB: > > row already exists or not. If you know that 99% of the time the row > > will exist, the update will probably be faster because you'll only > > execute one query 99% of the time. > > OK, but the point of the question i

Re: [HACKERS] update/insert,

2006-07-05 Thread mark
On Wed, Jul 05, 2006 at 04:59:52PM +0200, Zeugswetter Andreas DCP SD wrote: > > OK, but the point of the question is that constantly updating > > a single row steadily degrades performance, would > > delete/insery also do the same? > Yes, there is currently no difference (so you should do the upd

Re: [HACKERS] update/insert,

2006-07-05 Thread Zeugswetter Andreas DCP SD
> OK, but the point of the question is that constantly updating > a single row steadily degrades performance, would > delete/insery also do the same? Yes, there is currently no difference (so you should do the update). Of course performance only degrades if vaccuum is not setup correctly. Andr

Re: [HACKERS] update/insert,

2006-07-05 Thread Andrew Dunstan
Mark Woodward wrote: On Tue, Jul 04, 2006 at 11:59:27AM +0200, Zdenek Kotala wrote: Mark, I don't know how it will exactly works in postgres but my expectations are: Mark Woodward wrote: Is there a difference in PostgreSQL performance between these two different strategies: if(!

Re: [HACKERS] update/insert,

2006-07-05 Thread Mark Woodward
> On Tue, Jul 04, 2006 at 11:59:27AM +0200, Zdenek Kotala wrote: >> Mark, >> I don't know how it will exactly works in postgres but my expectations >> are: >> >> Mark Woodward wrote: >> >Is there a difference in PostgreSQL performance between these two >> >different strategies: >> > >> > >> >if(!ex

Re: [HACKERS] update/insert, delete/insert efficiency WRT vacuum

2006-07-05 Thread Hannu Krosing
Ühel kenal päeval, T, 2006-07-04 kell 14:53, kirjutas Zeugswetter Andreas DCP SD: > > > >Is there a difference in PostgreSQL performance between these two > > > >different strategies: > > > > > > > > > > > >if(!exec("update foo set bar='blahblah' where name = 'xx'")) > > > >exec("insert into f

Re: [HACKERS] update/insert, delete/insert efficiency WRT vacuum and

2006-07-04 Thread Zeugswetter Andreas DCP SD
> > >Is there a difference in PostgreSQL performance between these two > > >different strategies: > > > > > > > > >if(!exec("update foo set bar='blahblah' where name = 'xx'")) > > >exec("insert into foo(name, bar) values('xx','blahblah'"); or In pg, this strategy is generally more efficient,

Re: [HACKERS] update/insert, delete/insert efficiency WRT vacuum and

2006-07-04 Thread Martijn van Oosterhout
On Tue, Jul 04, 2006 at 11:59:27AM +0200, Zdenek Kotala wrote: > Mark, > I don't know how it will exactly works in postgres but my expectations are: > > Mark Woodward wrote: > >Is there a difference in PostgreSQL performance between these two > >different strategies: > > > > > >if(!exec("update fo

Re: [HACKERS] update/insert, delete/insert efficiency WRT vacuum and

2006-07-04 Thread Zdenek Kotala
Mark, I don't know how it will exactly works in postgres but my expectations are: Mark Woodward wrote: Is there a difference in PostgreSQL performance between these two different strategies: if(!exec("update foo set bar='blahblah' where name = 'xx'")) exec("insert into foo(name, bar) value

[HACKERS] update/insert, delete/insert efficiency WRT vacuum and MVCC

2006-07-03 Thread Mark Woodward
Is there a difference in PostgreSQL performance between these two different strategies: if(!exec("update foo set bar='blahblah' where name = 'xx'")) exec("insert into foo(name, bar) values('xx','blahblah'"); or exec("delete from foo where name = 'xx'"); exec("insert into foo(name, bar) values