Re: [PERFORM] Update join performance issues

2012-04-03 Thread Merlin Moncure
On Tue, Apr 3, 2012 at 12:29 PM, Kevin Kempter wrote: > Hi All; > > I have a query that wants to update a table based on a join like this: > > update test_one > set f_key = t.f_key > from >    upd_temp1 t, >    test_one t2 > where >    t.id_number = t2.id_number > > upd_temp1 has 248,762 rows > te

Re: [PERFORM] Update join performance issues

2012-04-03 Thread Thomas Kellerer
Kevin Kempter wrote on 03.04.2012 19:29: Hi All; I have a query that wants to update a table based on a join like this: update test_one set f_key = t.f_key from upd_temp1 t, test_one t2 where t.id_number = t2.id_number upd_temp1 has 248,762 rows test_one has 248,762 rows To extend on what K

Re: [PERFORM] Update join performance issues

2012-04-03 Thread Kevin Grittner
Andrew Dunstan wrote: > Why is test_one in the from clause? update joins whatever is in > the from clause to the table being updated. You almost never need > it repeated in the from clause. This is actually one of the nastier "gotchas" in converting from Sybase ASE or MS SQL Server to PostgreS

Re: [PERFORM] Update join performance issues

2012-04-03 Thread Andrew Dunstan
On 04/03/2012 01:29 PM, Kevin Kempter wrote: Hi All; I have a query that wants to update a table based on a join like this: update test_one set f_key = t.f_key from upd_temp1 t, test_one t2 where t.id_number = t2.id_number Why is test_one in the from clause? update joins whatev

Re: [PERFORM] Update join performance issues

2012-04-03 Thread Kevin Grittner
Kevin Kempter wrote: > update test_one > set f_key = t.f_key > from > upd_temp1 t, > test_one t2 > where > t.id_number = t2.id_number As written above, it is joining the two table references in the FROM clause and updating every row in test_one with every row in the JOIN -- whic

[PERFORM] Update join performance issues

2012-04-03 Thread Kevin Kempter
Hi All; I have a query that wants to update a table based on a join like this: update test_one set f_key = t.f_key from upd_temp1 t, test_one t2 where t.id_number = t2.id_number upd_temp1 has 248,762 rows test_one has 248,762 rows test_one has an index on f_key and an index on id_n