{"action":"created","issue":{"url":"https://api.github.com/repos/sferik/rails_admin/issues/2699","repository_url":"https://api.github.com/repos/sferik/rails_admin","labels_url":"https://api.github.com/repos/sferik/rails_admin/issues/2699/labels{/name}","comments_url":"https://api.github.com/repos/sferik/rails_admin/issues/2699/comments","events_url":"https://api.github.com/repos/sferik/rails_admin/issues/2699/events","html_url":"https://github.com/sferik/rails_admin/issues/2699","id":172895099,"number":2699,"title":"Postgres SELECT count(*) is slow","user":{"login":"ostinelli","id":110142,"avatar_url":"https://avatars.githubusercontent.com/u/110142?v=3","gravatar_id":"","url":"https://api.github.com/users/ostinelli","html_url":"https://github.com/ostinelli","followers_url":"https://api.github.com/users/ostinelli/followers","following_url":"https://api.github.com/users/ostinelli/following{/other_user}","gists_url":"https://api.github.com/users/ostinelli/gists{/gist_id}","starred_url":"https://api.github.com/users/ostinelli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ostinelli/subscriptions","organizations_url":"https://api.github.com/users/ostinelli/orgs","repos_url":"https://api.github.com/users/ostinelli/repos","events_url":"https://api.github.com/users/ostinelli/events{/privacy}","received_events_url":"https://api.github.com/users/ostinelli/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-08-24T08:34:54Z","updated_at":"2016-09-03T11:00:48Z","closed_at":"2016-09-03T08:42:27Z","body":"First of all, thank you for your work!\r\n\r\nHere's something that bit me today: in counting items (`SELECT COUNT(*) FROM table`), Postgres must walk through all rows ([source](https://wiki.postgresql.org/wiki/Slow_Counting)), hence it can become too slow for dashboard and pagination.\r\n\r\nWe have some tables of 1-10 Mio entries, and this is killing Rails Admin (the query analysis tells us that it takes around 10-20 seconds just to count the rows). Right now, we have disabled the dashboard and those tables.\r\n\r\nI'm not sure what to recommend here. There are alternatives to count the number of rows quickly, for instance as explained in [this StackOverflow](http://stackoverflow.com/a/14571935) answer.\r\n\r\nAny recommendations?"},"comment":{"url":"https://api.github.com/repos/sferik/rails_admin/issues/comments/244540271","html_url":"https://github.com/sferik/rails_admin/issues/2699#issuecomment-244540271","issue_url":"https://api.github.com/repos/sferik/rails_admin/issues/2699","id":244540271,"user":{"login":"mshibuya","id":486678,"avatar_url":"https://avatars.githubusercontent.com/u/486678?v=3","gravatar_id":"","url":"https://api.github.com/users/mshibuya","html_url":"https://github.com/mshibuya","followers_url":"https://api.github.com/users/mshibuya/followers","following_url":"https://api.github.com/users/mshibuya/following{/other_user}","gists_url":"https://api.github.com/users/mshibuya/gists{/gist_id}","starred_url":"https://api.github.com/users/mshibuya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mshibuya/subscriptions","organizations_url":"https://api.github.com/users/mshibuya/orgs","repos_url":"https://api.github.com/users/mshibuya/repos","events_url":"https://api.github.com/users/mshibuya/events{/privacy}","received_events_url":"https://api.github.com/users/mshibuya/received_events","type":"User","site_admin":false},"created_at":"2016-09-03T11:00:48Z","updated_at":"2016-09-03T11:00:48Z","body":"I've misread you, I got it now.\r\nThere's a little things we can do about pagination. Someday, somebody might build whole-sophisticated pagination library, which won't perform `COUNT(*)` query. But that's out of the scope of RailsAdmin, and we won't discuss it here.\r\nThanks for using RailsAdmin, and giving us the suggestion."}}
{"actor":{"display_login":"mshibuya"}}