Benchmarking tests of using RoR polymorphic relationships through strings versus integers, with and without indices.
Ruby
Pull request Compare This branch is 5 commits ahead of ngauthier:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
benchmarks
config
db
lib
README
Rakefile

README

Ruby on Rails Polymorphic Relation Benchmarking
Nick Gauthier (nick@smartlogicsolutions.com)
John Trupiano (john@smartlogicsolutions.com)

I created this app to test the polymorphic relationships in rails.

Specifically, I wanted to know if using strings for comparison was slower
than using a manual linking table via integers.

The current implementation includes four test scenarios for polymorphic tables:
1) integer
2) integer w/ index
3) string (as rails does it)
4) string w/ index (which you can add)

It currently supports mysql, sqlite3 and possibly postgres (not fully tested).  Whatever you
have defined in db/dbs.yml will get loaded and run against, allowing you to test more than
one DBMS at a single time.

==========
Rake Tasks
==========

# rake db:create
Reads in databases from db/dbs.yml and creates them

# rake db:drop
Reads in databases from db/dbs.yml and drops them

# rake db:migrate
Runs migrations on all databases in db/dbs.yml

# rake db:reload
create -> drop -> migrate

# rake run (default)
Runs the simulations