At first I thought the idea of putting all the words into one giant table with an identifier for which subset they came out of was a good idea. Then I tried it.

Basically, MySQL suffers a *huge* performance hit with the large table (600K+ words) vs. the smaller table (350+K words); I think I ran up against some sort of limit in the software. For comparison's sake, though, identical queries took 3.31 seconds for the large table, and 0.76 seconds for the smaller one -- over 4 times as long.

Since it's not possible -- or, as was well pointed out, practical -- to leave the table name as a variable, and since upon further review I only have 4 tables to deal with (I thought it was going to be more like 12, but I ruled a bunch of word subsets out), I'm just going to have 4 separate statements prepped up (and yes, one database handle *can* support multiple queries -- I've done it before).

Thanks for your help anyway.

Alex Kirk

In reply to Re: Re: Querying databases in a loop by schnarff
in thread Querying databases in a loop by schnarff

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.