Speed up time-sensitive database process in Rails applications using a Connection pool, Threads, and Arel

Sometimes dealing with DB processes in a Rails application consume a lot of time. Often there are a bunch of small and simple DB queries that go endless. For example, bulk insertions or bulk updates in tables. Dividing it into various background jobs is an idle solution. In a few scenarios, we can't prefer background jobs e.g. the change you apply, makes the existing data invalid. In this article, we will see how to complete a large set of DB queries under minutes which would otherwise take hours if not optimized. It's a better practice to create a rake