Connecting Tech Pros Worldwide Forums | Help | Site Map

memory size exhausted error - Too much info back from query - what to do?

Dave Smithz
Guest
 
Posts: n/a
#1: Nov 22 '05
Hi there,
I changed one of my MySQL search queries to allow a situation where the user
gets much more information returned.

However, it has now given me the error message:
Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to
allocate 42 bytes) in /usr/share/pear/DB/mysql.php on line 290

OK I understand what this means (I assume) that the program is trying to
allocate more memory to return my query result but it wont let it.

However, I need this query to return this info, so what can I do?

Any help / explanations appreciated.

Kind regards

Dave.



Ja NE
Guest
 
Posts: n/a
#2: Nov 22 '05

re: memory size exhausted error - Too much info back from query - what to do?


sorry, no help here, but just wondering...
[color=blue]
> Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to[/color]

what are you searching for? what is in that database?

let say you have some ...books in your database. few thousands of
them... whouldn't it be better for query to return just headlines, and
maybe introduction or summary? and link to the whole think instead of
returning that huge amount of data?

--
Ja NE
http://fotozine.org/?omen=janimir
--
unlimitedbro@gmail.com
Guest
 
Posts: n/a
#3: Nov 22 '05

re: memory size exhausted error - Too much info back from query - what to do?


Hi,

sounds like you should use LIMIT or use unbuffered queries
(http://us2.php.net/mysql_unbuffered_query)

If you use unbuffered queries be sure you read the notes about
mysql_num_rows().

Peter Fox
Guest
 
Posts: n/a
#4: Nov 22 '05

re: memory size exhausted error - Too much info back from query - what to do?


Following on from Dave Smithz's message. . .

Firstly
Mysql will let you retrieve a bit at a time. Something like LIMIT -
RTFM SELECT syntax. This will open other options for getting results.

Secondly
Are you properly disposing of previous large result sets as a matter of
course. ISTR that PHP does GC at end of script by default and possibly
sql allocations cascade later from these.

Thirdly
PRUNE! Any user who can interpret 16Mb of data doesn't need a database
- they have a brain the size of a planet anyway!. (Possibly cut out
blobs from the query and retrieve a bit at a time.?)
[color=blue]
>Hi there,
>I changed one of my MySQL search queries to allow a situation where the user
>gets much more information returned.
>
>However, it has now given me the error message:
>Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to
>allocate 42 bytes) in /usr/share/pear/DB/mysql.php on line 290
>
>OK I understand what this means (I assume) that the program is trying to
>allocate more memory to return my query result but it wont let it.
>
>However, I need this query to return this info, so what can I do?
>
>Any help / explanations appreciated.
>
>Kind regards
>
>Dave.
>
>[/color]

--
PETER FOX Not the same since the bridge building business collapsed
peterfox@eminent.demon.co.uk.not.this.bit.no.html
2 Tees Close, Witham, Essex.
Gravity beer in Essex <http://www.eminent.demon.co.uk>
Closed Thread