Skip to content
Find time-consuming database queries for ActiveRecord-based Rails Apps
Ruby Shell
Branch: master
Clone or download
Latest commit 6cdf779 Aug 17, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci add CI Jul 20, 2019
bin rubocop -a Jul 14, 2019
examples add logs, fix slack notification Jul 22, 2019
lib BUMP 0.0.8 Aug 17, 2019
spec add unsubscribe toggle Aug 17, 2019
.gitignore init query_track Jul 13, 2019
.rspec init query_track Jul 13, 2019
.rubocop.yml init query_track Jul 13, 2019 BUMP 0.0.8 Aug 17, 2019
Gemfile rubocop -a Jul 14, 2019
Gemfile.lock BUMP 0.0.8 Aug 17, 2019
LICENSE.txt init query_track Jul 13, 2019 Merge pull request #13 from kirillshevch/feature/add-unsubscriber-toggle Aug 17, 2019
Rakefile rubocop -a Jul 14, 2019
query_track.gemspec add description Jul 20, 2019


Gem Version CircleCI Maintainability

Tool for finding time-consuming database queries for ActiveRecord-based Rails Apps. Provides Slack notifications with backtrace, raw SQL, time duration, etc.


Add this line to your application's Gemfile:

gem 'query_track'

And then execute:

$ bundle

Or install it yourself as:

$ gem install query_track


SQL Duration Limit

Specify SQL duration query limit (in seconds):

QueryTrack::Settings.configure do |config|
  config.duration = 0.5

Console Log

Enable console logs from config:

QueryTrack::Settings.configure do |config|
  config.duration = 0.5
  config.logs = true

Log Example


To avoid noisy warnings from used gems, and places where fat queries are justified, you can filters SQL by backtrace. For example, you have installed activeadmin and want to skip everything from app/admin:

QueryTrack::Settings.configure do |config|
  config.duration = 0.5
  config.filters = ['app/admin']

Enable/Disable toggle

Enable/disable with ENV variables to turn it on/off without code push. By default QueryTrack is enabled.

QueryTrack::Settings.configure do |config|
  config.duration = 0.5
  config.enabled = ENV['QUERY_TRACK_ENABLED']

Slack Notifications

To receive notifications about slow queries into Slack, you need to install incoming-webhooks and put link into config file:

QueryTrack::Settings.configure do |config|
  config.duration = 0.5
  config.notifications.slack = ''

Incoming Hook Example


Bug reports and pull requests are welcome on GitHub at


The gem is available as open source under the terms of the MIT License.

You can’t perform that action at this time.