Well, I decided to say the hec with our Access database and wrote scripts all day long to transfer everything over to Mysql. (Now I don't have to worry about using a MS server woohoo!). However, I've ran into a little problem. I have 5 tables of data and depending on user input I search different tables. I've found that if the data is in one or all of the searched tables the search is fast. However, when if even one of the tables being searched doesn't contain the item I need, it is slow. Very very very slow. It goes from taking 2 to 3 seconds to taking about 15 to sometimes 25 seconds. I'm dealing with around 350,000 items in the database. My question is: Is this a perl problem that could some how be circumvented, or a MySql problem (which i assume it is). The only reason I doubt it might be a MySql problem is when I do a command line MySql search and the item isn;t there it takes at most 3 to 5 seconds. Here is some sample code listed below. Anyone have ideas?
my $dbh = DBI->connect("DBI:mysql:database=mydatabase;host=localhost",
"name", "password",
{'RaiseError' => 1});
$SQLStatement = "SELECT etc..."
$sel = $dbh->prepare( $SQLStatement );
$sel->execute() || die "Could not open database";
while( ($somedata) = $sel->fetchrow_array )
{#actions...}