{"action":"created","issue":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/10724","labels_url":"https://api.github.com/repos/yiisoft/yii2/issues/10724/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2/issues/10724/comments","events_url":"https://api.github.com/repos/yiisoft/yii2/issues/10724/events","html_url":"https://github.com/yiisoft/yii2/issues/10724","id":130409264,"number":10724,"title":"$dataProvider->getModels(); Very slow event if there have many rows.","user":{"login":"yoyhosoft","id":2453589,"avatar_url":"https://avatars.githubusercontent.com/u/2453589?v=3","gravatar_id":"","url":"https://api.github.com/users/yoyhosoft","html_url":"https://github.com/yoyhosoft","followers_url":"https://api.github.com/users/yoyhosoft/followers","following_url":"https://api.github.com/users/yoyhosoft/following{/other_user}","gists_url":"https://api.github.com/users/yoyhosoft/gists{/gist_id}","starred_url":"https://api.github.com/users/yoyhosoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yoyhosoft/subscriptions","organizations_url":"https://api.github.com/users/yoyhosoft/orgs","repos_url":"https://api.github.com/users/yoyhosoft/repos","events_url":"https://api.github.com/users/yoyhosoft/events{/privacy}","received_events_url":"https://api.github.com/users/yoyhosoft/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/yiisoft/yii2/labels/status:need%20more%20info","name":"status:need more info","color":"d4c5f9"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2016-02-01T16:23:47Z","updated_at":"2016-02-02T07:55:29Z","closed_at":null,"body":"Hi,\r\nI found some issue that may impact performance,\r\nhere is my code that very slow when I run it's.\r\n\r\n```\r\n       $searchModel = new ItemsMainSearch();\r\n       $dataProvider = $searchModel->search(Yii::$app->request->queryParams); \r\n\r\n\t$modelList = $dataProvider->getModels();\r\n\techo \\yii\\widgets\\LinkPager::widget([\r\n\t   'pagination'=>$dataProvider->pagination,\r\n\t]);\r\n```\r\n\r\nAfter that I comment code at below, and speed comeback.\r\n```\r\n       $searchModel = new ItemsMainSearch();\r\n       $dataProvider = $searchModel->search(Yii::$app->request->queryParams); \r\n\r\n\t// $modelList = $dataProvider->getModels();\r\n\techo \\yii\\widgets\\LinkPager::widget([\r\n\t   'pagination'=>$dataProvider->pagination,\r\n\t]);\r\n```\r\n\r\nI not sure it's slow because $dataProvider->getModels() or not, so I test by using below code, and it's comeback to very slow again.\r\n```\r\n<?= GridView::widget([\r\n        'dataProvider' => $dataProvider,\r\n        'filterModel' => $searchModel,\r\n        'columns' => ....\r\n?>\r\n```\r\n\r\nSo, could you please check on this issue.\r\n\r\nP.S. Totals rows after query about > 100,000 rows\r\nP.S. Sorry for my English, because very I drunk Today.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/comments/178431879","html_url":"https://github.com/yiisoft/yii2/issues/10724#issuecomment-178431879","issue_url":"https://api.github.com/repos/yiisoft/yii2/issues/10724","id":178431879,"user":{"login":"dynasource","id":125726,"avatar_url":"https://avatars.githubusercontent.com/u/125726?v=3","gravatar_id":"","url":"https://api.github.com/users/dynasource","html_url":"https://github.com/dynasource","followers_url":"https://api.github.com/users/dynasource/followers","following_url":"https://api.github.com/users/dynasource/following{/other_user}","gists_url":"https://api.github.com/users/dynasource/gists{/gist_id}","starred_url":"https://api.github.com/users/dynasource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dynasource/subscriptions","organizations_url":"https://api.github.com/users/dynasource/orgs","repos_url":"https://api.github.com/users/dynasource/repos","events_url":"https://api.github.com/users/dynasource/events{/privacy}","received_events_url":"https://api.github.com/users/dynasource/received_events","type":"User","site_admin":false},"created_at":"2016-02-02T07:55:29Z","updated_at":"2016-02-02T07:55:29Z","body":"This is not for the bug tracker, but slowness is completely logical looking at your SQL:\r\n1) you are running a LIKE search on a medium large table 100.000\r\n2) you are running many of the likes\r\n3) perhabs you are also ordering.\r\n\r\nTogether this could result in a very long query, especially on non-indexed cols."}}