Hello, I'm somewhat new to Perl and inexperienced with SQL. I've been using DBIx::Simple to pull information from various tables and it has worked great until I have an array of about 40,000 values that I need to match in @all_ids. I've tried a few other methods but run out of memory or it takes too long to complete. After I pull these values, I then need to get the number of unique parts. What is the most efficient way to query an sql table involving a large array?
my @data = $dbh->select( 'table', '*', { ww => [@ww], id => [@all_ids], } )->hashes; my $counter = 0; for (my $i = 0; $i < @data; $i++) { my $part = $data[$i]{'part'}; my $n_value = $data[$i]{'n'}; if ($part !~ m/^0000000.*/) { if (!$seen{$part}) { $seen{$part} = 1; $counter++; } } elsif (!$seen{$n_value}) { $seen{$n_value} = 1; $counter++; } } print "The uin count is $counter\n"; }
In reply to SQL Select by Scully4Ever
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |