How I Make Result Of Sql Querys With Limit Different In Each Query?
I have the following SQL: SELECT id, url FROM link WHERE visited = false ORDER BY id LIMIT 500; --*500 is only a example I'm making a webcrawler and there is a table with li
Solution 1:
Have you tried for update/returning?
update link
set visiting =truefrom (
select id
from link
where visiting =falseand visited =false
limit 500forupdate
) as batch
where batch.id = link.id
returning *;
Solution 2:
Skip 1500 rows and take the next 500
SELECT id, url
FROM link
WHERE visited =falseORDERBY id
LIMIT 500OFFSET1500http://www.postgresql.org/docs/8.3/interactive/queries-limit.html
Post a Comment for "How I Make Result Of Sql Querys With Limit Different In Each Query?"