Re: Using DBI, better option than importing into @array



Jason wrote:
The most current problem is SPEED! From sheer lack of knowledge, I'm
importing the subjects table into an array in the beginning of the
script, then using a for loop throughout the program to access that
array. But the program is running pretty slow, and I'm sure that the
bottleneck is with this array.

How do you know that? Anyway, it seems to me that you can easily skip that array.

my $filelist = $dbh->selectall_arrayref("SELECT `id`, `lastmodified`,
`subject` FROM $forum_subjects ORDER BY lastmodified DESC");

for ( 0 .. 20 ) {
my $topiclist = ... id=" . $dbh->quote( $filelist->[$_][0] ) . " ...

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
.



Relevant Pages

  • Re: trouble backup with perl.
    ... >> I'm experiencing to write a perl script for to make backup with afio ... This is a very inefficient loop, ... > whole file to an array and then loop over the array. ... >> Pleeese help I need backup. ...
    (perl.beginners)
  • Re: string retrieval issue
    ... Chicago Bears|NFC North ... not writing the third element back to the array). ... You didn't include it in your script. ... Fear is the mind-killer. ...
    (comp.lang.perl.misc)
  • Re: Scalable method for searching in relatively big files
    ... directly in the file A each line for the while loop, ... it would interfer with the search if I used the array @a for the while ... So it isn't a scalable solution in my opinion. ... Show us your script, and someone here will be able to help. ...
    (comp.lang.perl.misc)
  • Re: even rows for checkbox forms with no splitting of boxes from values
    ... 'mod' on the array length with a denominator equal to the width of the row, ... State saving really depends on what the script is already doing. ... So I usually roll my own checkboxes. ... #this is to create an array with 25-50 strings 2-10 in length ...
    (comp.infosystems.www.authoring.cgi)
  • Re: settimeout needs alert() ???
    ... function slider { ... and use script to replace the src and title attributes. ... are downloaded completely. ... The usual strategy is to load all of the images in to an array of image ...
    (comp.lang.javascript)