I'm attempting to eagerly load a relatively large table using the Sequel ORM to test the amount of results I get based on using different key conditions:
a = Eqmifsequel.eager(:paauditsequels).all
The relationship looks like this:
one_to_many :paauditsequels, :primary_key => [:serial_number,:customer_number], :key => [:serial_number,:cust]
The tables are the following sizes
eqmifsequel : 69357 records
paauditsequel : 8648976 records
When I run the line of code at the top, I get a 'stack level too deep' error. I've tried upping my ulimit stack size (up to 1GB), but that doesn't seem to change anything.
I'm guessing I'm doing something bad, but I don't have the knowledge (math, cs, hardware) to know what or why.
Can anyone give me some suggestions? Is there a way I can calculate how much stack space I'm about to use when I try to join and return two large tables? Does this have to do with how Sequel is creating the join? If it were to succeed, would I end up crashing my system?
Haha, yeah. When you call .all it will return the entire data set in a single block.
Whatever you were planning on doing with the data that's the wrong approach. If you're trying to iterate through everything use .find_each like so:
Eqmifsequel.joins(:paauditsequels).find_each do |i|
# something
end
If you're only interested in the number of results:
Eqmifsequel.joins(:paauditsequels).count