New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bulk inserts #43

Open
benoist opened this Issue Mar 2, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@benoist
Copy link

benoist commented Mar 2, 2017

Hi,

To be able to do really fast imports it's better to create a bulk insert query. Currently I'm creating a string with StringBuilder and escape the values before adding it to the query string, however this leads to memory bloat as the query string can easily be over 1MB.

Perhaps it would be nice to support a feature like:

db.insert("table_name", {"column_1", "column_2"}) do |statement|
  1000.times do
    statement.push("value", 1)
  end
end
@hinrik

This comment has been minimized.

Copy link
Contributor

hinrik commented Nov 13, 2017

I needed this functionality in a project of mine and came up with this: https://github.com/hinrik/bulk_insert.cr

Is this something that could get included in crystal-db?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment