If I correctly understand your question, you would want to
create a table in the database for each of your existing
text files. To suck the entire contents out of a table,
you would run a query against it (most likely
SELECT * FROM tablename;, if you really do
want
everything) and use the query object's
fetchrow_array method in list context.
However, if you do that, the performance improvement isn't
likely to be much on reads or appends, although deleting
data from the start of the list would probably improve
considerably. Sucking an entire file into memory tends to
be faster than sucking an entire database table into memory
for the simple reason that it's going through a less complex
access mechanism. The major advantages of databases are in
seeking data (so you don't have to bring everything into
memory) and concurrency, and slurping the whole table doesn't
take advantage of either of them.
So, what do you actually do with the data after reading it?
Do you really need to have everything in memory or can you
use SQL to specify a subset of the data which is actually
interesting to you?
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.