My experience surprised me - it didn't matter whether the script had cursors or not ... when the client upgraded from 1 GB to 2 the data warehouse import routine went from 30 hours to 30 minutes. I find that kind of non-linear response fascinating…
Are you certain this isn't just a performance issue? I've never studied programming formally (certainly not AI), but it sounds to me like the client could just be hitting the page file a lot at 1GB (I assume you're talking about system RAM there, right?*) and not at 2GB. I have no clue what platform you're on, but is the cache dynamic and is it expanding while your import routine is running? That kind of thing doesn't fascinate me, it makes me angry until I find out
why something like that is happening (which probably explains why I studied physics instead of comp. sci.).
* if you're talking about the size of the data, then your results are extremely counterintuitive, and I would need to know more about what it is you're doing and any discussion about database calls makes my eyes glaze over.…and I wanted to explore the boundaries, but writing the routine that would be capable of terminating itself and, as one reviewer noticed, "keeping good notes" seemed more suitable to a machine than my limited patience.
What's the big deal about self-terminating routines? All routines terminate themselves eventually. ;) I have a feeling I'd be more impressed if I understood what it is you're trying to do with the data, but please see the above footnote about databases. My database experience is limited to smallish corporate environments where things are
much simpler.
It's the self-reference that keeps popping up that I find fascinating. Turns out Microsoft's development team kept their performance measuring scripts in database format - and the OS version is one of the indexed fields. They also offer a stress test application whose first task is the production of an entire set of text files, suitable for sending back to the development team for analysis. It does this by dynamically producing a SQL script that outputs the environmental and performance values.
About the only "self-reference" I've dealt with are recursive function calls (fun stuff… assuming you did it on purpose ;) ), which sounds only
vaguely similar to what that constructed SQL script is doing.
Think about it for a moment ... all the effort that's gone into making machines act like humans, when a more constructive use of our time would be to "teach" them to improve themselves. Yes, this is a trivial application of the concept, but variations for network traffic direction and data mining are practical.
Now you're just getting philosophical. Getting a chunk of software to act more like humans is irrelevant (or if you'd like to compare it to the Grand Unified Field Theory, pointless unless you accept that wandering down the path is what's important even if the destination is unreachable/meaningless), making a chunk of software perform a new task isn't.