Re: [GENERAL] Function with limit and offset - PostgreSQL 9.3

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: [GENERAL] Function with limit and offset - PostgreSQL 9.3
Дата
Msg-id CAKFQuwYjoMiAfzG9j2LUanHxPiLOdmUP6WnwtMHnTb-r6QyqKQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [GENERAL] Function with limit and offset - PostgreSQL 9.3  (marcinha rocha <marciaestefanidarocha@hotmail.com>)
Список pgsql-general
On Thursday, June 8, 2017, marcinha rocha <marciaestefanidarocha@hotmail.com> wrote:

On Thursday, June 8, 2017, marcinha rocha <marciaestefanidarocha@hotmail.com> wrote:

On my original select, the row will have migrated = false. Maybe All I need to put is a limit 2000 and the query will do the rest?


You shoud try to avoid the for loop, 

Why?

Mainly expected performance concerns. The engine is designed to handle results sets as opposed to single row iterating.  Whether it's true in your case I don't know but I would assume that operating on sets would be faster.
 

Ok, cool!

Now, how do tell the function to return the number of touched rows? On this case, it should always be 2000.


Unless there are fewer rows to process.  You could always just do i = i + 1 in the loop.

David J. 

В списке pgsql-general по дате отправления:

Предыдущее
От: marcinha rocha
Дата:
Сообщение: Re: [GENERAL] Function with limit and offset - PostgreSQL 9.3
Следующее
От: John R Pierce
Дата:
Сообщение: Re: [GENERAL] Function with limit and offset - PostgreSQL 9.3