looping over a small record set over and over in a function
От | Ivan Sergio Borgonovo |
---|---|
Тема | looping over a small record set over and over in a function |
Дата | |
Msg-id | 20090619202320.244657e0@dawn.webthatworks.it обсуждение исходный текст |
Ответы |
Re: looping over a small record set over and over in a function
Re: looping over a small record set over and over in a function |
Список | pgsql-general |
I've a record set on which I have to loop several times. The function should return the same record set + one more computed field. Something that in could look like: foreach(row) { // compute stuff if(...) { } // place stuff in field[N+1] of the row } if(some condition) { // } foreach(row) { // compute stuff if(...) { } // place stuff in a field[N+1] of the row } if(some condition) { // } ... actually return row + computed field. in pgplsql where each loop depends on the result of the previous. The dataset is very small. If I could easily load all the dataset into an array, loop through it and then just update the computed field it would be nice... but how? Is it really worth to load the whole record set in an array, loop over etc... in spite of eg. building a temp table with the same structure of the input record set + 1 field, loop over the table etc... what about all the UPDATEs involved to change field N+1 of the temp table? Will be they expensive? thanks -- Ivan Sergio Borgonovo http://www.webthatworks.it
В списке pgsql-general по дате отправления: