Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Question about properly laying out a database

by dws (Chancellor)
on Dec 12, 2001 at 02:54 UTC ( [id://131095]=note: print w/replies, xml ) Need Help??


in reply to Question about properly laying out a database

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.

  • Comment on Re: Question about properly laying out a database

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://131095]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2024-04-19 08:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found