fluent-plugin-sql
fluent-plugin-sql copied to clipboard
All rows are read into memory prior flushing
When I select a large table with no row limit, all rows a read into memory and the process never finishes. It would be nice if there was some kind of batch/cursor read method, which flushes the rows before reading all of them.
If you want to read big table in batch way, using embulk or something is better.
Does someone know how to use cursor in activerecord?
There are some gems for SQL cursor.
- https://github.com/afair/postgresql_cursor
- https://github.com/zoocasa/activerecord-postgresql-cursors
Activerecord-postgresql-cursors seems dead. I will try postgresql_cursor gem.
Are there no mysql cursor gem?
embulk does not allow incremental importing (using state file like this plugin) and has no fluentd support as far as I can see. I forked this repo and made a working fork that uses activerecord batch to allow fetch. I make some more tests and propose a pull request.
embulk does not allow incremental importing (using state file like this plugin)
Ah, I see...
uses activerecord batch
Use find_in_batches
or similar method?
I wait your patch.