Re: [GENERAL] getting the ranks out of items with SHARED

2005-07-14 Thread Janning Vygen
Am Mittwoch, 13. Juli 2005 15:35 schrieb Tom Lane: > Janning Vygen <[EMAIL PROTECTED]> writes: > > this way it works: > > > > CREATE TEMP TABLE ranking AS *Q*; > > EXECUTE 'UPDATE temp_gc SET gc_rank = ranking.rank > > FROM ranking WHERE temp_gc.mg_name = ranking.mg_name;'; > > > > and this way it

Re: [GENERAL] getting the ranks out of items with SHARED

2005-07-14 Thread Tom Lane
Janning Vygen <[EMAIL PROTECTED]> writes: > and this is the combined statement: >UPDATE temp_gc > SET gc_rank = ranking.rank > FROM ( > SELECT > *, > ranking(r1.gc_gesamtpunkte, r1.gc_gesamtsiege) AS rank > FROM ( > SELECT > mg_name, > gc_

Re: [GENERAL] getting the ranks out of items with SHARED

2005-07-13 Thread Tom Lane
Janning Vygen <[EMAIL PROTECTED]> writes: > this way it works: > CREATE TEMP TABLE ranking AS *Q*; > EXECUTE 'UPDATE temp_gc SET gc_rank = ranking.rank > FROM ranking WHERE temp_gc.mg_name = ranking.mg_name;'; > and this way it doesn't: > UPDATE temp_gc > SET gc_rank = ranking.rank > FROM (*Q*)

Re: [GENERAL] getting the ranks out of items with SHARED

2005-07-13 Thread Janning Vygen
Hi, Am Mittwoch, 13. Juli 2005 00:03 schrieb Tom Lane: > Janning Vygen <[EMAIL PROTECTED]> writes: > > I have a guess, what happens here: The order of the subselect statement > > is dropped by the optimizer because the optimizer doesn't see the > > "side-effect" of the ranking function. > > That

Re: [GENERAL] getting the ranks out of items with SHARED

2005-07-12 Thread Tom Lane
Janning Vygen <[EMAIL PROTECTED]> writes: > I have a guess, what happens here: The order of the subselect statement is > dropped by the optimizer because the optimizer doesn't see the "side-effect" > of the ranking function. That guess is wrong. I think the problem is that you are trying to upd

[GENERAL] getting the ranks out of items with SHARED

2005-07-12 Thread Janning Vygen
Hi, in postgresql you have several possibilites to get the rank of items. A thread earlier this year shows correlated subqueries (not very performant) and other tricks and techniques to solve the ranking problem: http://archives.postgresql.org/pgsql-general/2005-05/msg00157.php The possibility