dongyao4419 2013-12-11 17:40
浏览 51

Laravel 4中的DB :: paginate失败

I am running a typical query on a fairly large MariaDB 10.0.6 database (~2 million records), where I want to have only top few records returned. The 'where' statement I am using will match no more than 5-10 records.

This statement fails:

$lucky = $this->post->select("ID")->where('luckynumber', '=', '12345')->paginate(1);

whereas this one works (the only difference is ->paginate vs. first):

$lucky = $this->post->select("ID")->where('luckynumber', '=', '12345')->first();

The log files suggest that I run out of memory (which I already increased to 512 MB):

[2013-12-11 16:15:39] log.ERROR: 500 - Allowed memory size of 536870912 bytes exhausted (tried to allocate 532152320 bytes) @ /lucky/12345 exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Allowed memory size of 536870912 bytes exhausted (tried to allocate 532152320 bytes)' in /var/www/lbs/app/storage/views/f775c03b70963c0:109

I am using Ubuntu Linux 12.04, nginx, php 5.5.6,

What is the problem?

  • 写回答

1条回答 默认 最新

  • dongmuyuan3046 2014-06-14 01:23
    关注

    seems as would mariaDB produce a temporary Table. So take care to index the Coloumn 'luckynumber'

    评论

报告相同问题?

悬赏问题

  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示