News for hackers. Stuff that matters.
Re:It's not Ruby that's slow, it's your database by gls2ro on Wednesday November 09, 2022 @02:41AM (#33528499)
It is good advice to learn SQL.

I would suggest enabling the following two configurations in any Rails project. It should be a must in any new Rails project IMO:

1. Enable `config.active_record.strict_loading_by_default` - this will raise ActiveRecord::StrictLoadingViolationError on almost all cases of N+1 thus forcing the developer to fix it

2. Set `config.active_record.warn_on_records_fetched_greater_than` so that you know when someone will load a lot of records, thus forcing to paginate, load only what is needed ...

I think starting with these two will help mitigate a lot of problems even when using ORM in Rails.

There are no comments on this comment yet.