<!-- Presentation generated by Internet Assistant for Microsoft PowerPoint 97 -->
<HTML>
<HEAD>
<meta name="GENERATOR" content="Microsoft Internet Assistant for Microsoft PowerPoint 97">
<TITLE>Do more with less!</TITLE>
</HEAD>
<BODY >
<CENTER>
<TABLE WIDTH=100%>
<TR> <TD WIDTH=100% ALIGN=CENTER>
<A HREF="sld001.htm">First</A>
<A HREF="sld018.htm">Previous</A>
<A HREF="sld020.htm">Next</A>
<A HREF="sld102.htm">Last</A>
<A HREF="index.htm">Index</A>
<A HREF="dbi.perl.org">Home</A>
<A HREF="tsld019.htm">Text</A>
</TD> </TR>
<TR> <TD WIDTH=100% ALIGN=CENTER>
<IMG SRC="img019.gif" usemap="#Objmap" WIDTH=800 HEIGHT=600 BORDER=0>
</TD> </TR>
</TABLE>
<P>Slide 19 of 102</P>
</CENTER>
<!-- <UL>
<H2>Do more with less!</H2>
</UL></P>
<P><UL>
<LI><H2>Reduce the number of DBI calls
</H2>
<UL>
<LI>The DBI is fast -- but it isnt free!
<LI>
</UL></UL><UL>
<LI><H2>Using RaiseError is faster than checking return values
</H2>
<UL>
<LI>and much faster than checking $DBI::err or $h->err
<LI>
</UL></UL><UL>
<LI><H2>Using fetchall_arrayref (or selectall_arrayref) is now much faster
</H2>
<UL>
<LI>if using a driver extension compiled with the DBIs Driver.xst wrapper (most are)
<LI>because the loop is written in C and doesnt make a method call per row
<LI>
</UL></UL><UL>
<LI><H2>Using fetchall_arrayref is possible for very large result sets
</H2>
<UL>
<LI>new $max_rows parameter limits rows returned (and memory consumed)
<LI>just add an outer loop to process the results in batches, or do it in-line:
</UL>$row = shift(@$cache)
<BR> || shift @{$cache=$sth->fetchall_arrayref(undef, 1000)};</UL></P>
<P> -->
</Body>
</HTML>