Skip to content

Commit cd8803b

Browse files
committed
Added script for relation allocations [skip ci]
1 parent af11104 commit cd8803b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

benchmark/relation.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
require "bundler/setup"
2+
Bundler.require(:default)
3+
require "active_record"
4+
5+
class Product < ActiveRecord::Base
6+
searchkick
7+
end
8+
9+
relation = Product.search("apples")
10+
11+
stats = AllocationStats.trace do
12+
relation.where(store_id: 1).where(in_stock: true).order(:name).limit(10).offset(50)
13+
end
14+
puts stats.allocations(alias_paths: true).to_text

0 commit comments

Comments
 (0)