Hello Monks, I am trying to query a database using PERL. I have 2 FILES. FILE1 already contains a list of primarykeys. FILE2 contains a list of terms. Primary keys are related to abstracts in the database. I want to query database such that, I will get primarykeys from FILE1 which also has terms from FILE2 in their abstracts. I posted this question on stackoverflow, here is the link http://stackoverflow.com/questions/8600324/subquerying-in-mysql-with-full-text-querying/8662901#8662901

I got the answer posted by stevenl. Now my concern is I have around 58,00,000 primarykeys in FILE1 and 26,000 terms in FILE2. This makes it time consuming. I am going to work on multiple such FILES. One of the answers by pseudocode on the same link of stackoverflow suggested me to reduce database transaction and instead use PERL to do this work. According to him, I will get the abstracts using the primarykeys in FILE1 and search the terms from FILE2 in the abstract using string search. If any if the terms from FILE2 is present in the abstract get the corresponding primarykey. I will put the terms from FILE2 in an array.

I would like to know will this really help and do the work more efficiently? And how can I implement it?

Any help is greatly appreciated.


In reply to Alternative to querying a database to save time by smandape1

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.