{"action":"created","issue":{"url":"https://api.github.com/repos/amatsuda/kaminari/issues/681","repository_url":"https://api.github.com/repos/amatsuda/kaminari","labels_url":"https://api.github.com/repos/amatsuda/kaminari/issues/681/labels{/name}","comments_url":"https://api.github.com/repos/amatsuda/kaminari/issues/681/comments","events_url":"https://api.github.com/repos/amatsuda/kaminari/issues/681/events","html_url":"https://github.com/amatsuda/kaminari/pull/681","id":68388690,"number":681,"title":"Pagination without having to SELECT COUNT(*).","user":{"login":"bryanrite","id":829668,"avatar_url":"https://avatars.githubusercontent.com/u/829668?v=3","gravatar_id":"","url":"https://api.github.com/users/bryanrite","html_url":"https://github.com/bryanrite","followers_url":"https://api.github.com/users/bryanrite/followers","following_url":"https://api.github.com/users/bryanrite/following{/other_user}","gists_url":"https://api.github.com/users/bryanrite/gists{/gist_id}","starred_url":"https://api.github.com/users/bryanrite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bryanrite/subscriptions","organizations_url":"https://api.github.com/users/bryanrite/orgs","repos_url":"https://api.github.com/users/bryanrite/repos","events_url":"https://api.github.com/users/bryanrite/events{/privacy}","received_events_url":"https://api.github.com/users/bryanrite/received_events","type":"User","site_admin":false},"labels":[{"id":8456562,"url":"https://api.github.com/repos/amatsuda/kaminari/labels/ActiveRecord","name":"ActiveRecord","color":"d7e102","default":false},{"id":8456735,"url":"https://api.github.com/repos/amatsuda/kaminari/labels/Rails/ActionView","name":"Rails/ActionView","color":"444444","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":25,"created_at":"2015-04-14T14:13:36Z","updated_at":"2016-11-14T04:12:55Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/amatsuda/kaminari/pulls/681","html_url":"https://github.com/amatsuda/kaminari/pull/681","diff_url":"https://github.com/amatsuda/kaminari/pull/681.diff","patch_url":"https://github.com/amatsuda/kaminari/pull/681.patch"},"body":"This PR is unfinished (no specs), I just wanted to test the waters as to whether you would want it.\n\nThis is a tweak I've had to use on several projects so that Kaminari doesn't do a COUNT due to slow Postgres COUNT issues, as also described: #240, #545. I cannot use indexes due to where conditions, or any other fancy ways to get the count as the tables are just too big, so this PR adds the ability to use `paginate_without_count` to paginate using `next` and `previous` links that never call COUNT.\n\nInstead of COUNTing the dataset, we assume that if the current paged set is equal to the limit value, there is another page. We only expose `next` and `previous` links, since we have no way of knowing the number of pages.  We override the Pagination class simply so we can change the partial class. Making the partial class configurable internally would alleviate that override if that is cleaner.\n\nThe only issue is if your count is exactly divisible by the per page limit, we'll show an erroneous next link on the last page... but to me this is a small price to pay for being able to page without timing out due to PG's sequential COUNT scan.\n\nThoughts?\n"},"comment":{"url":"https://api.github.com/repos/amatsuda/kaminari/issues/comments/260244831","html_url":"https://github.com/amatsuda/kaminari/pull/681#issuecomment-260244831","issue_url":"https://api.github.com/repos/amatsuda/kaminari/issues/681","id":260244831,"user":{"login":"yuki24","id":386234,"avatar_url":"https://avatars.githubusercontent.com/u/386234?v=3","gravatar_id":"","url":"https://api.github.com/users/yuki24","html_url":"https://github.com/yuki24","followers_url":"https://api.github.com/users/yuki24/followers","following_url":"https://api.github.com/users/yuki24/following{/other_user}","gists_url":"https://api.github.com/users/yuki24/gists{/gist_id}","starred_url":"https://api.github.com/users/yuki24/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yuki24/subscriptions","organizations_url":"https://api.github.com/users/yuki24/orgs","repos_url":"https://api.github.com/users/yuki24/repos","events_url":"https://api.github.com/users/yuki24/events{/privacy}","received_events_url":"https://api.github.com/users/yuki24/received_events","type":"User","site_admin":false},"created_at":"2016-11-14T04:12:54Z","updated_at":"2016-11-14T04:12:54Z","body":"@cgriego Totally! Actually, you don't have to use `#paginate_without_count`. Instead, you can  just use `#link_to_prev_page` and `#link_to_next_page` with a \"without count\" scope and they should work fine. Also, the `PaginatorWithoutCount` class seems overengineering to me. Maybe we can just get rid of `#paginate_without_count` entirely?"}}
{"actor":{"display_login":"yuki24"}}