<p></p>
<p dir="auto">Regarding N+1 queries, I tried a gem called 'bullet', which needs a bit of config in config/environments/development.rb:</p>
<pre class="notranslate"><code class="notranslate"> config.after_initialize do
#Enable bullet in your application
Bullet.enable = true
Bullet.rails_logger = true
end
</code></pre>
<p dir="auto">It would then complain about N*1 queries, or suggest to remove eager loading where not needed.</p>
<pre class="notranslate"><code class="notranslate">GET /changeset/127673
USE eager loading detected
OldRelation => [:redaction]
Add to your query: .includes([:redaction])
Call stack
</code></pre>
<p dir="auto">As an example, the suggested changes to "changeset_controller.rb - show" would be to add additional :includes for old_nodes/ways/relations: <code class="notranslate">:include => [:old_tags, :redaction]</code></p>
<pre class="notranslate"><code class="notranslate"> @node_pages, @nodes = paginate(:old_nodes, :include => [:old_tags, :redaction], :conditions => { :changeset_id => @changeset.id }, :per_page => 20, :parameter => "node_page")
@way_pages, @ways = paginate(:old_ways, :include => [:old_tags, :redaction], :conditions => { :changeset_id => @changeset.id }, :per_page => 20, :parameter => "way_page")
@relation_pages, @relations = paginate(:old_relations, :include => [:old_tags, :redaction], :conditions => { :changeset_id => @changeset.id }, :per_page => 20, :parameter => "relation_page")
</code></pre>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4141#issuecomment-2197651282">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLP3K5MJDW5OXAYXD2TZJXFBZAVCNFSM6AAAAABKCKQUJ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJXGY2TCMRYGI">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLIDDGLIOEHHQLLPU6LZJXFBZA5CNFSM6AAAAABKCKQUJ6WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUC7V7VE.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/pull/4141/c2197651282</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/4141#issuecomment-2197651282",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/4141#issuecomment-2197651282",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>