prosopite icon indicating copy to clipboard operation
prosopite copied to clipboard

:mag: Rails N+1 queries auto-detection with zero false positives / false negatives

Results 22 prosopite issues
Sort by recently updated
recently updated
newest added

As I can see in [source](https://github.com/charkost/prosopite/blob/main/lib/prosopite.rb#L109) prosopite uses `ActiveRecord::Base` to define database adapter. If you have multiple databases you probably have multiple successors of `ApplicationRecord` where each of them uses...

This change avoids memory allocation when detecting the mysql adapter.

Some gems cache missing methods after the first call. This can cause Prosopite to miss duplicate queries. For example, the N+1 query for `author` in the following `builder` template goes...

While using prosopite on an application with many N+1s, I wanted to focus my efforts on the N+1s with the most associated queries, so I added a count of queries....

We have a custom logger, but in order to inspect the callstack and customize the message, we end up throwing out the notification_str and reaching into `Thread.current[:prosopite_notifications]` directly to get...

Thanks for the great work on this gem. Can we compare more in depth why would this gem be useful given that Rails strict_loading exists? (and maybe we can add...

It's related to the rails default behavior connected to the associations assignment. Here my structure of models: ```ruby class CreateTables < ActiveRecord::Migration[6.1] def change create_table :model1s do |t| t.string :name...

Right now, the `Prosopite` does quite a bit. I think it could be helpful to refactor out some of the logic into their own classes to better encapsulate the behavior....

This line: https://github.com/charkost/prosopite/blob/36f7f5a4fa800fcfa1f9bef5cae94c9739b128fc/lib/prosopite.rb#L147C20-L147C71 Is hitting this: https://github.com/rails/rails/blob/a6a840f150d2d153af33648d93fc4553f5a3857e/activerecord/lib/active_record/connection_handling.rb#L263-L276 See https://github.com/rails/rails/pull/51349 btw. it's hard to debug because it just raises the query rather than the error, here: https://github.com/charkost/prosopite/blob/36f7f5a4fa800fcfa1f9bef5cae94c9739b128fc/lib/prosopite.rb#L125