Is this php script going run into memory problems?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jeddiki
    Contributor
    • Jan 2009
    • 290

    Is this php script going run into memory problems?

    Hi,

    I am using the following code to get an updated version of
    my main data table but I am concerned that the processor will
    run out of memory.

    Since the result will be help in an array i.e. in memory is this
    any concern ?

    This is the code:

    Code:
    $sql = "SELECT cb_last.*, cb_prev.* FROM cb_last LEFT JOIN cb_prev ON cb_last.id=cb_prev.id WHERE cb_last.day_no = '$dayno' ORDER BY cb_last.id";
    $result = mysql_query($sql)
    	or die("could not JOIN cb_last AND cb_prev". mysql_error());
    I am also not sure if I can use the WHERE clause when joining to tables ??
    Last edited by Dormilich; Jan 12 '10, 03:11 PM. Reason: fixed [code] tags
  • dgreenhouse
    Recognized Expert Contributor
    • May 2008
    • 250

    #2
    If the table has a lot of records, your script will probably run out of memory if you saved the results in an array.

    The results set (i.e. the $rs in $rs = mysql_query($sq l)) is just a pointer and won't cause a memory fault. Otherwise, you wouldn't be able to perform a selection on multi-mega record tables. That's where the mysql_fetch_??? ? commands come into play.

    As long as you don't try to save store the contents in memory, you shouldn't run into a problem.

    Comment

    • jeddiki
      Contributor
      • Jan 2009
      • 290

      #3
      Thanks,

      I suspected that mysql must be handling the memory/disc side of things
      as I know thtere are huge databases being run on it !

      Comment

      Working...