2

I'm working on an existing Spree application (using Rails 4.2.1 and mysql), and the insertion of InventoryRecords one at a time is killing the performance (during checkout for sure).

When researching the problem, I found this as a suggestion, but it uses the copy command in PostgreSQL, which MySQL doesn't appear to have:

https://github.com/spree/spree/issues/4216#issuecomment-32556519

I've also found a few recommendations to use the activerecord-import gem, but not necessarily with Spree:

Batch insertion in rails 3

This article benchmarks a few techniques, including the aforementioned:

http://blog.elentok.com/2012/08/activerecordpostgresql-mass-insertion.html

It seems clear that using the COPY command is the most efficient, but being that I'm limited to MySQL, what's the best solution?

Community
  • 1
  • 1
scoots
  • 715
  • 4
  • 16
  • 1
    You may be interested in this old pull request which was not merged. It added a quantity for inventory units to deal with some issues like this: https://github.com/spree/spree/pull/4741 It adds a quantity to inventory units to deal with performance issues around inserting large amounts of the same variant. – gmacdougall Sep 16 '15 at 15:04
  • @gmacdougall Do you know if spree/spree#4741 was adapted to Solidus? I think this would be good to get in. – BenMorganIO Oct 11 '15 at 04:31

0 Answers0