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...}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.