Re: getting the ranks out of items with SHARED - Mailing list pgsql-general

From Tom Lane
Subject Re: getting the ranks out of items with SHARED
Date
Msg-id 27411.1121261755@sss.pgh.pa.us
Whole thread Raw
In response to Re: getting the ranks out of items with SHARED  (Janning Vygen <vygen@gmx.de>)
Responses Re: getting the ranks out of items with SHARED
List pgsql-general
Janning Vygen <vygen@gmx.de> 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*)
> ranking
> WHERE temp_gc.mg_name = ranking.mg_name;

It's difficult to be sure without looking at EXPLAIN output, but I would
guess that the second query is being done with a plan that involves
multiple scans of "*Q*", and that's confusing your function.

            regards, tom lane

pgsql-general by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: Strange memory behaviour with PGreset() ...
Next
From: Gnanavel S
Date:
Subject: Re: INSERT INTO from a SELECT query