SELECT only a certain set of rows at a time

Posted by prmatta on Stack Overflow See other posts from Stack Overflow or by prmatta
Published on 2010-03-11T22:18:21Z Indexed on 2010/03/12 23:17 UTC
Read the original article Hit count: 204

Filed under:
|
|
|

I need to select data from one table and insert it into another table. Currently the SQL looks something like this:

   INSERT INTO A (x, y, z)
   SELECT x, y, z
   FROM B b
   WHERE ...

However, the SELECT is huge, resulting in over 2 millions rows and we think it is taking up too much memory. Informix, the db in this case, runs out of virtual memory when the query is run.

How would I go about selecting and inserting a set of rows (say 2000)? Given that I don't think there are any row ids etc.

© Stack Overflow or respective owner

Related posts about sql

Related posts about database