When I upload a 10Mb file (from my browser) to my Rails app, a Tempfile
object gets created on the server. When the contents gets written to the
database, it’s a simple INSERT, so basically the data is read to memory
and then inserted into MySQL.
How come the data is not streamed to the DB so we avoid the memory
issue? Is this a short coming of ActiveRecord or the MySQL/Ruby driver
or something else?
I guess that it’s not possible to stream from the database either? (At
least the API doesn’t appear to support this).
Any insight much appreciated.