1
votes

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
Is your luckynumber column indexed?Fractaliste

1 Answers

0
votes

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