I created this bug in RobotFramework:
After further investigation, it seems that this is actually a bug with Jython's implementation of Subprocess and not an issue with RobotFramework itself (see comments in github issue).
Basically, when using Subprocess to run a db-query script which generates 174 MB of stdout data piped directly to a file, Subprocess with stdout redirected to a file takes about 150 seconds to complete while the script normally completes in about 17 seconds in the shell or using Python System calls.
Jython's implementation of Subprocess when using file pipes needs to be fixed to pipe directly to a file instead of doing whatever it is doing now.
I'm kind of new to Jython and how exactly it does everything it does so I hope you'll excuse me if I misdiagnosed the cause a bit :) ... I am pretty sure this is a Jython problem though!