We recently encountered a performance issue in our Rails application due to multiple N+1 .exists? queries on a single API endpoint, specifically when checking if the "data_imports" feature is enabled for a user. This pattern became problematic as we added more beta features, leading to slower API response times. To address this, we preloaded all records and then checked them in memory instead of executing additional queries. By using includes to preload records and implementing a scope that only loads necessary records, we were able to solve the N+1 problem while maintaining performance.