DEV Community

Muhammad Hussain
Muhammad Hussain

Posted on

Ruby on Rails reselect and rewhere lets you optimize performance

Enhance your Rails queries with ActiveRecord's reselect and rewhere methods!

  1. reselect: Streamline your data retrieval by dynamically adjusting the SELECT clause in your queries. Instead of rewriting entire queries, reselect lets you optimize performance by selecting only the necessary columns. Perfect for efficient data fetching and cleaner code!. like Post.where(category:'Technology').reselect(:title, :created_at)
  2. rewhere: Modify existing WHERE clauses on-the-fly without starting from scratch. Whether adapting filter criteria or handling dynamic data conditions, rewhere empowers developers to build adaptable queries for dynamic data filtering and efficient querying. like User.where(active: true).rewhere(last_login_date: Date.today - 7.days)

Top comments (0)

Cloudinary image

Optimize, customize, deliver, manage and analyze your images.

Remove background in all your web images at the same time, use outpainting to expand images with matching content, remove objects via open-set object detection and fill, recolor, crop, resize... Discover these and hundreds more ways to manage your web images and videos on a scale.

Learn more

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay