Skip to content

Latest commit

 

History

History
36 lines (26 loc) · 1.25 KB

README.md

File metadata and controls

36 lines (26 loc) · 1.25 KB

README

This is a demo app for the article - https://blog.widefix.com/importance-sql-for-rails-experts/

Preffered dependencies versions:

  • PostgreSQL 15
  • Ruby 3

Configure DB manually by changing config/database.yml or create DB user with the same name as your system username and then do this:

  • set DATABASE_URL env var: export DATABASE_URL="postgres://localhost:5432". Change the port 5432 to yours if it's running on another port
  • run the benchmark: ./run.sh

My results:

Warming up --------------------------------------
                ruby     1.000  i/100ms
                 sql    48.000  i/100ms
Calculating -------------------------------------
                ruby      7.169  (± 0.0%) i/s -     36.000  in   5.034830s
                 sql    521.333  (± 9.8%) i/s -      2.592k in   5.037741s

Comparison:
                 sql:      521.3 i/s
                ruby:        7.2 i/s - 72.72x  slower

Notes

This app was initially generated by the following command:

rails new demo-fast-sql -d postgresql --skip-action-mailer --skip-action-mailbox --skip-action-text --skip-active-job --skip-active-storage --skip-action-cable --skip-asset-pipeline --skip-javascript --skip-hotwire --skip-jbuilder --skip-test
--skip-system-test