Search Postgresql Archives

Re: dubious optimization of the function in SELECT INTO target list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Oleksii Kliukin <alexk@xxxxxxxxxxxx> writes:
> This should work, but I'm interested in finding out why the original statement behaves the way I?ve described. 

plpgsql's SELECT INTO is only capable of storing a single result row,
so it only executes the statement far enough to obtain one row, and
then stops (as though a LIMIT were present).  There is no guarantee
about how much useless computation will get done underneath.

If this is not the behavior you want, you shouldn't be using SELECT INTO
(which, I'll note, is very clearly documented as meant only for single-row
results).  A plausible alternative is a FOR IN SELECT loop, which would
have the benefit that you could actually do something with the row values.

			regards, tom lane


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux