Stack level too deep on sequel eager load

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?

Answers


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

Need Your Help

How to manage serving static content from subdomain during development

asp.net asp.net-mvc subdomain static-content asp.net-mvc-4

I want to start serving up my static content from a subdomain in production. What is the best way to do this while maintaining a smooth development experience in Visual Studio? Up until this poin...

When uploading an image/file to server, ServiceStack throws a UnauthorizedAccessException

android stream monodroid servicestack filestream

I used the following code from the answer to this question by @scott How do I upload an image to a ServiceStack service?