{"id":13877933,"url":"https://github.com/rubysamurai/query_count","last_synced_at":"2025-05-13T13:17:11.111Z","repository":{"id":40621904,"uuid":"265883124","full_name":"rubysamurai/query_count","owner":"rubysamurai","description":"SQL queries counter for Rails apps","archived":false,"fork":false,"pushed_at":"2022-02-13T12:09:01.000Z","size":49,"stargazers_count":47,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-13T13:17:02.471Z","etag":null,"topics":["activerecord","activerecord-queries","query-counter","rails","sql-query"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rubysamurai.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-21T15:23:53.000Z","updated_at":"2025-03-10T11:27:24.000Z","dependencies_parsed_at":"2022-07-14T04:10:33.496Z","dependency_job_id":null,"html_url":"https://github.com/rubysamurai/query_count","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubysamurai%2Fquery_count","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubysamurai%2Fquery_count/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubysamurai%2Fquery_count/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubysamurai%2Fquery_count/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rubysamurai","download_url":"https://codeload.github.com/rubysamurai/query_count/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253948505,"owners_count":21988961,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["activerecord","activerecord-queries","query-counter","rails","sql-query"],"created_at":"2024-08-06T08:01:35.282Z","updated_at":"2025-05-13T13:17:11.079Z","avatar_url":"https://github.com/rubysamurai.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# Query Count\n\n[![Gem Version](https://badge.fury.io/rb/query_count.svg)](https://badge.fury.io/rb/query_count)\n[![CI](https://github.com/rubysamurai/query_count/workflows/CI/badge.svg)](https://github.com/rubysamurai/query_count/actions?query=workflow%3ACI)\n\nA zero-configuration gem to count the number of SQL queries performed by the ActiveRecord.\nSupports **Rails 4.2+** and **Ruby 2.0+** (the complete testing matrix is [here](.github/workflows/ci.yml)).\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'query_count'\n```\n\nRun `bundle install`.\n\n## Usage\n\nThe gem will automatically include the number of SQL queries to the default Rails log.\n\n```\nActiveRecord: 34.0ms | SQL Queries: 8 (1 cached)\n```\n\nThis log example shows that the total number of queries was 8, and 1 was cached, which means the request hit the database 7 times.\n\n`QueryCount::Counter` provides public methods `counter`, `counter_cache`, `reset_counter`, `reset_counter_cache`.\n\nRSpec 3 example:\n\n```ruby\nit 'performs exactly 5 queries' do\n  QueryCount::Counter.reset_counter\n  5.times { User.last }\n  expect(QueryCount::Counter.counter).to eq 5\nend\n```\n\n## License\n\n`query_count` © Dmitriy Tarasov. Released under the [MIT](LICENSE.txt) license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubysamurai%2Fquery_count","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frubysamurai%2Fquery_count","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubysamurai%2Fquery_count/lists"}