Skip to content

Instantly share code, notes, and snippets.

View beeksiwaais's full-sized avatar

Beeksi beeksiwaais

View GitHub Profile
@beeksiwaais
beeksiwaais / mysql2_column_cache.rb
Created April 23, 2012 14:07 — forked from raggi/mysql2_column_cache.rb
Mysql2 Column Cache for Rails 3.0.12
# = MONKEY PATCH: Memoize Mysql2 Columns
#
# Reduces SHOW FIELDS selects in production to essentially 0 calls.
#
# == Reason:
#
# * We have some pages that are (with rails 3.0.12) generating nearly 1200 SHOW
# FIELDS sql statements.
# * These come from ActiveRecord::Associations during complex join semantics.
# * Esentially, through some relations, Arel::Table instances don't have