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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dave Smithz

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

    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

    #2
    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
    fotografija = zapisano svjetlom | fotozine = foto-e-zin

    --

    Comment

    • unlimitedbro@gmail.com

      #3
      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( ).

      Comment

      • Peter Fox

        #4
        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@eminen t.demon.co.uk.n ot.this.bit.no. html
        2 Tees Close, Witham, Essex.
        Gravity beer in Essex <http://www.eminent.dem on.co.uk>

        Comment

        Working...