Skip to content

Instantly share code, notes, and snippets.

@chiastolite
Created December 4, 2017 06:02
Show Gist options
  • Save chiastolite/2e80b1bac8ca28fced1b1eb713b129ec to your computer and use it in GitHub Desktop.
Save chiastolite/2e80b1bac8ca28fced1b1eb713b129ec to your computer and use it in GitHub Desktop.
activerecord-cause tip
# ログからクエリ発行が多いとこを特定するために呼出元を回数順に並べるやつ
# 途中のsedは色付け用のエスケープシーケンスを消すやつ
grep 'ActiveRecord::Cause' log/development.log| sed $'s,\x1b\\[[0-9;]*[a-zA-Z],,g' | sort |uniq -c | sort -n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment