You don't mention it, but I assume that there's additional per-automobile information in each database record. I also assume that the "price range" is an enumeration. (I've been car shopping lately, and most sites seem set up that way.)

Conceptually, you'll be reading each of the 500 records, applying the search criteria, and then collecting up the matching records for display. Easy stuff, with many implementation options.

At an implementation level, you probably want to avoid reading the full record until you need to (assuming there's lots more stuff in the full record). This suggests splitting your data into two tables. The first would hold search criteria and the unique key. The second would hold the unique key and the remaining data.

You could put each table into a separate DBM file, or, if performance is a big concern, you could leave the "search criteria" file as a flat file. It would only be ~24K, assuming an average record size of 50 bytes and a 500 entry limit. It's going to be faster to suck a file of that size into memory and search it in-place than it is to read the same data record-by-record from a DBM.


In reply to Re: Question about properly laying out a database by dws
in thread Question about properly laying out a database by Stamp_Guy

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.