You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using MySQL and loading yaml data, the tables are cleared via "TRUNCATE". This is a DDL statement in MySQL and seems to break the surrounding transaction in Rails. In consequence, the INSERT statements get very slow on my system.
Importing about 500.000 records takes two hours. When I replace the TRUNCATE by a DELETE statement, the surrounding transaction works fine and the import is done within minutes. The additional time for the DELETE instead of TRUNCATE is negligible. I thus suggest to either always use a "DELETE" statement or to put the transaction block around the "load_records" call.
I used rails 5.1.5 with mysql2 gem 0.4.10 to produce the issue.
The text was updated successfully, but these errors were encountered:
module YamlDbWithoutTruncation
def truncate_table(table)
true
end
end
YamlDb::SerializationHelper::Load.singleton_class.prepend(YamlDbWithoutTruncation) if ENV['WITHOUT_TRUNCATION'] == true
When using MySQL and loading yaml data, the tables are cleared via "TRUNCATE". This is a DDL statement in MySQL and seems to break the surrounding transaction in Rails. In consequence, the INSERT statements get very slow on my system.
Importing about 500.000 records takes two hours. When I replace the TRUNCATE by a DELETE statement, the surrounding transaction works fine and the import is done within minutes. The additional time for the DELETE instead of TRUNCATE is negligible. I thus suggest to either always use a "DELETE" statement or to put the transaction block around the "load_records" call.
I used rails 5.1.5 with mysql2 gem 0.4.10 to produce the issue.
The text was updated successfully, but these errors were encountered: