Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • Yeah, that WHERE was just placeholder. This should do it. Thanks! Commented Dec 18, 2009 at 1:01
  • huh! where will you store the result of the above query? Isn't it more logical to fetch a limited set of rows (whatever is optimal for the memory available on your system), do some operation and fetch a next set of rows and so on...? Not saying your answer is wrong, just saying that everything that MySQL docs say is not a solution, more often that not it's just an answer to a question. Solutions are supposed to keep performance and feasibility into account. BTW, "some large number" in docs is (2^64)-1 which is max of (unsigned) bigint Commented Sep 17, 2018 at 5:01
  • @Fr0zenFyr "...that everything that MySQL docs say is not a solution, more often that not it's just an answer to a question" -- Not in this case. The quoted section of my answer is part of the official MySQL Docs, not the user contributed comments section below it. Commented Sep 17, 2018 at 17:20
  • I din't deny that the quote is from official docs. All I was trying to say was that the statement in docs is very general and doesn't take the possible memory overflow into account. Say for example, the result of a query gives > 2^20 results. My comment simply was pointing at this caveat, nothing about your answer in specific. I also mentioned in previous comment that such issue can be addressed by looping, for ex, by getting up to 2^15 results at a time (or less), process it and get next set and so on.. Commented Sep 17, 2018 at 17:32