in reply to how to speed up querys to mysql

Helo, i have one problem, i have two arrays and want to check its values in mysql databases. i wrote this script, but when here is 30000 queries
[SNIP]
foreach $a1(@a1) { foreach $b1(@b1) { $sth = $dbh->prepare( "SELECT a1.ID FROM a1, a1_b1, b1 WH

In addition to the excellent answers you got thus far, I have a pair of remarks that nobody seems to have done yet:

  1. this is not "your script", but a portion of it. So far so fine, but to help people who will read your post it is generally recommended to build a minimal but complete example still exhibiting the problem (often in the course of doing so one actually solves the problem, but I doubt this could have been the case here);
  2. you may have noticed that at the top of many people's example code they inserted the following two lines:
    use strict; use warnings;
    I recommed you to do the same. They instruct perl to restrict your freedom in a way that will help you to avoid common programming mistakes, hence implicitly to give you all the help it can. Of course you will then have to declare your (lexical) variables with my.