Search Postgresql Archives

Re: Function with limit and offset - PostgreSQL 9.3

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

 



On Thursday, June 8, 2017, marcinha rocha <marciaestefanidarocha@xxxxxxxxxxx> 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. 

[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