擅长:python、mysql、java
<p>或者,如果您在原位创建一个实现基本resultset大小限制的原始查询,会发生什么情况?在</p>
<p>阿拉:<a href="https://docs.djangoproject.com/en/1.3/topics/db/sql/#index-lookups" rel="nofollow">https://docs.djangoproject.com/en/1.3/topics/db/sql/#index-lookups</a></p>
<pre><code>while min < rowcount:
min += 500
max = min + 500
articles = Article.objects.raw('SELECT * from article where id > %s and id < %s' % (min, max))
for old_article in articles:
# create the new article
article.save()
</code></pre>