Re: [TLM] Re: [GENERAL] How to insert on duplicate key?

2007-12-28 Thread Greg Smith
On Fri, 28 Dec 2007, Robert Treat wrote: A given transaction doesn't have a way to determine if there are live transaction looking at the row, that would require quite a bit of knowledge about what else is occuring in the system to be able to determine that. That level of knowledge/complexity

Re: [TLM] Re: [GENERAL] How to insert on duplicate key?

2007-12-28 Thread Trevor Talbot
On 12/28/07, Robert Treat <[EMAIL PROTECTED]> wrote: > On Thursday 27 December 2007 12:23, Samantha Atkins wrote: > > Since it is known to be dead > > is it automatically removed when there are no live transaction that > > reference or may reference it and its data page space marked available > >

Re: [TLM] Re: [GENERAL] How to insert on duplicate key?

2007-12-28 Thread Robert Treat
On Thursday 27 December 2007 12:23, Samantha Atkins wrote: > On Dec 24, 2007, at 11:15 PM, Greg Smith wrote: > > This may be better because it isn't doing the query first. You may > > discover that you need to aggressively run one of the VACUUM > > processes (I'd guess regular and ANALYZE but not

Re: [TLM] Re: [GENERAL] How to insert on duplicate key?

2007-12-27 Thread Samantha Atkins
On Dec 24, 2007, at 11:15 PM, Greg Smith wrote: This may be better because it isn't doing the query first. You may discover that you need to aggressively run one of the VACUUM processes (I'd guess regular and ANALYZE but not FULL) in order to keep performance steady as the number of r

[TLM] Re: [GENERAL] How to insert on duplicate key?

2007-12-27 Thread Greg Smith
On Tue, 25 Dec 2007, [EMAIL PROTECTED] wrote: insert a record into a table, and when the record already exists(according to the primary key), update it. There is an example that does exactly that, 37-1, in the documentation at http://www.postgresql.org/docs/current/static/plpgsql-control-stru

[TLM] [GENERAL] How to insert on duplicate key?

2007-12-27 Thread [EMAIL PROTECTED]
Hi all, I have a table like this, CREATE TABLE mytable( avarchar(40), btext, ctext, PRIMARY KEY (a, b) ); What I want to do is: insert a record into a table, and when the record already exists(according to the primary key), update it. I know that there is a ON DUPLICATE clause

Re: [GENERAL] How to insert on duplicate key?

2007-12-24 Thread Greg Smith
On Tue, 25 Dec 2007, [EMAIL PROTECTED] wrote: insert a record into a table, and when the record already exists(according to the primary key), update it. There is an example that does exactly that, 37-1, in the documentation at http://www.postgresql.org/docs/current/static/plpgsql-control-stru

Re: [GENERAL] How to insert on duplicate key?

2007-12-24 Thread [EMAIL PROTECTED]
Michael Glaesemann wrote: On Dec 24, 2007, at 22:03 , [EMAIL PROTECTED] wrote: I have googled and currently the only way I can find is do query first and then update or insert. Or alternatively, UPDATE and see if you've affected any rows. If not, insert. Michael Glaesemann grzm seespotcod

Re: [GENERAL] How to insert on duplicate key?

2007-12-24 Thread Michael Glaesemann
On Dec 24, 2007, at 22:03 , [EMAIL PROTECTED] wrote: I have googled and currently the only way I can find is do query first and then update or insert. Or alternatively, UPDATE and see if you've affected any rows. If not, insert. Michael Glaesemann grzm seespotcode net

[GENERAL] How to insert on duplicate key?

2007-12-24 Thread [EMAIL PROTECTED]
Hi all, I have a table like this, CREATE TABLE mytable( avarchar(40), btext, ctext, PRIMARY KEY (a, b) ); What I want to do is: insert a record into a table, and when the record already exists(according to the primary key), update it. I know that there is a ON DUPLICATE clause