Hi,<br />while reading 20GB table through PL/PERL function , it constantly grows in RAM. <br />I wanted to ask you
whichis the best way to read table inside that function without such memory consumption.<br />Thanks in advance<br
/><br/>Code is here:<br /><br />CREATE FUNCTION pattern_counter("patLength" integer)<br /> RETURNS varchar AS<br
/>$BODY$<br/> my $rv = spi_exec_query("select sequence from entry");<br /> my $rowCount = $rv->{processed};<br
/> my $patLen = $_[0];<br /> my $patt = '';<br /> my %patterns=();<br /> foreach my $rn (0 .. $rowCount
-1){<br/> my $row = $rv->{rows}[$rn];<br /> my $seq = $row->{sequence};<br /> for (my $x =
1;$x<=length($seq)- $patLen;$x++){<br /> $patt=substr($seq,$x,$patLen);<br /> if (! defined
$patterns{$patt}){<br /> $patterns{$patt}=1;<br /> }else{<br /> $patterns{$patt}++;<br />
}<br/> }<br /> }<br /> foreach $patt (keys %patterns){<br /> my $sql="insert into patterns
values('".$patt."',".$patterns{$patt}.")";<br/> spi_exec_query($sql);<br /> }<br />return '';<br />$BODY$<br />
LANGUAGEplperl VOLATILE<br /> COST 100;<br /><br /><br clear="all" /><br />-- <br
/>---------------------------------------<br/>Viktor Bojović<br />---------------------------------------<br />Wherever
Igo, Murphy goes with me<br />