Pivotal Labs

Main menu

Skip to primary content
Skip to secondary content
  • About
  • Case Studies
  • Team
    • Executives
    • Locations
      • San Francisco (HQ)
      • Boston
      • Boulder
      • Denver
      • London
      • Los Angeles
      • New York
  • Community
    • Blogs
    • Tech Talks
    • Events
  • Careers
    • Lifestyle
    • Principles & Practices
    • Benefits
    • FAQ
    • Apply
  • Tools
  • Contact
    • Press Room
    • Press Releases
    • In The News
    • Press Kit
  • All
  • Labs
  • Standup
  • Tracker

Standup 09/24/2008: Why does my JVM crash running SOLR?

David Stevenson
Thursday, September 25, 2008

Interesting from yesterday

The difference between new-style-includes (rails 2.1+) and old-style-includes in rails is the size of the query. In the old style, rails selects all the data from all the tables in a single query, using some crazy renames that look like this:

SELECT users.id AS t1_r1, users.name AS t1_r2,
profiles.id AS t2_r1, ...
FROM users
LEFT OUTER JOIN profiles ON profiles.user_id = users.id

This can get really bad if you :include multiple has_many associations, because the number of rows multiplies rapidly! In the new-style-includes, ActiveRecord does one SELECT per table like so:

SELECT * FROM users
SELECT * FROM profiles WHERE user_id IN (1,2,3,4,5,6)

More queries, but each one returns a small number of rows, and overall is a big performance improvement. The problem comes when you add :conditions that reference tables you :include. The new style will attempt to write this query:

SELECT * FROM users WHERE profiles.gender = 'M'
# ERROR - no table profiles!

So, you can make all your includes faster as long as you don’t have any :conditions, :order, or :select clauses that select from tables other than the base finder table. In our case, we hardcoded this check to always use the new-style-includes, manually ensuring that we don’t fall into these failing situations.

Ask for Help

“Why does my JVM seg. fault when running SOLR?”

Virtual machines should never segmentation fault! It’s probably a JVM/OS/library issue, so check try a different version of the JVM and check that it has all it’s proper dependencies. Alternatively, try a different VM entirely.

“Is there a way in Excel to ‘reshape’ 2D data?”

If you have an NxM matrix in Excel, you can transpose it to a MxN matrix easily. But if you want to convert it to a (M/2)x(N*2) through a reshaping you’re probably on your own. You could open it in ruby and reshape the arrays that way…

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Add New Comment Cancel reply

Your email address will not be published.

David Stevenson

David Stevenson
San Francisco

Recent Posts

  • 03/13/13: [SF] Use postgres!
  • Standup for 2/9/2012: NP in P time? As usual, no.
  • Standup 2/6/2012: Tracker UI updates
Subscribe to David's Feed

Author Topics

agile (10)
devise (1)
ec2 (1)
engines (1)
ios (1)
activerecord (3)
inverse_of (1)
css (2)
engineyard (1)
iphone (3)
rubymine (1)
rails (5)
aws (1)
javascript (1)
xmpp (1)
gogaruco (3)
activeresource (1)
heroku (1)
solr (1)
bug (1)
patch (1)
  • About
  • Case Studies
  • Team
  • Community
  • Careers
  • Tools
  • Contact
  • Labs
  • Events

Contact Us

contact@pivotallabs.com
+1 415-77-PIVOT
TwitterLinkedInFacebook

Pivotal Tracker

Tracker is the award-winning agile project management tool that enables real-time collaboration around a shared, prioritized backlog.
Visit pivotaltracker.com >