Re:I Replaced Baremetrics and ChartMogul with Rake
by skaber on Wednesday January 06, 2021 @11:10PM
(#25667188)
Your Ruby ActiveRecord query is so under optimized, you are loading a ton of records that instantiate objects and then apply a filter on this huge array.
I'm pretty sure you could make it 100x faster.
[ Parent
| on HN ]
Re:I Replaced Baremetrics and ChartMogul with Rake
by hiharryhere on Wednesday January 06, 2021 @11:30PM
(#25667290)
I don't think those are ActiveRecord queries, they look like calls to the Stripe api via the Stripe gem. It's possible those filters like 'deleted?' are not able to be applied when querying the API.
Re:I Replaced Baremetrics and ChartMogul with Rake
by ezekg on Wednesday January 06, 2021 @11:33PM
(#25667303)
Correct. Those are Stripe API calls made through their client library.
Re:I Replaced Baremetrics and ChartMogul with Rake
by jon-wood on Thursday January 07, 2021 @09:13AM
(#25671209)
I think someone else has pointed out that they're not ActiveRecord queries, but even if they were, this is a script designed to be run manually a few times a week, which takes maybe a minute. You'd need significantly more than 100x performance increase for any time at all put into optimising queries to pay for themselves.