Hello!
We are writing a script in perl for database management (non SQL, but text format). Let's say we have 100 ads, each ad is stored in a separated file and is composed of a line with data separated by /
For example
data1/data2/data3/.../data500
What would be better in speed to display the 100 ads on a page?
1: Storing all ads in ONE file, read this file and process the data? Like:
data1/data2/data3/.../data500
dataX1/dataX2/dataX3/.../dataX500
dataY1/dataY2/dataY3/.../dataY500
or
2: Storing the number of each ads in one file, reading this file, then opening each ad file (identified by its number)?
The disadvantage of the 1st way is that when an ad is modified or deleted, there are a few files to change: The file of the ad itself, the "all ads" file, the "last modified ads" file, etc. But maybe this way would be faster for displaying the 100 ads?
The disadvantage of the 2nd way (as I see it) is making a lot of disk access (one by ad). But ads updates would be more simple to do, as we would have only one file (the individual ad file) to update.
Which way (or a 3rd one) would you recommend? The website is expected to have a quite high traffic.
Thank 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.