No help for your memory problem, but a hint for your code: change my $preMonthDB = DBI->connect("DBI:Excel:file=March_15.xls") or die "Cannot connect: " . $DBI::errstr; to my $preMonthDB = DBI->connect("DBI:Excel:file=March_15.xls",'','',{ RaiseError => 1}); and get rid of all of the other or die after DBI method calls. RaiseError enables implicit error checks, even where you forgot the manual error checks.

Also get used to using placeholders instead of pasting literals into the SQL statement, to avoid SQL injection and to enable reuse of prepared statements.

On the other hand, 2.2 GBytes is not that much of RAM on any recent machine. pme++ is right, avoiding DBI and DBD::Excel would avoid some overhead. The SQL statements you use here are quite trivial to replace with a few lines of perl, plus you could run all statistics in a single loop instead of running several times over all of the data.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

In reply to Re: DBI::Excel Memory usage by afoken
in thread DBI::Excel Memory usage by martinslmn

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.