You have questions of memory, but which memory are you talking about? First, there's the memory on the database server. Then there's the memory used on the client, which can be split in the memory used by the client libraries, and the memory used on the Perl side.

As for select var1,var2,var3 from table, yes, that will cause the database server to load the entire table into memory (although if var1,var2 and var3 form a key, it might just load the index), but that is because you want all rows. It would be a bad database if it loaded the entire table if you have a where clause that causes only a fraction of the rows to be returned (and have the index to avoid a table scan).

Do the $Sth->fetchrow() read one row from the array in memory? OR it return some pointer than the fetchrow read one record from that table on disk at the time?
That isn't up to the DBI to decide. But that's up to your DBD (database driver) and the installed client libraries.

In reply to Re: Fetchrow question by JavaFan
in thread Fetchrow question by alainb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.