Re: [PBML] Regarding flat file access vs. database
- On Wed, 2006-05-04 at 16:03 +0200, Roman Daszczyszak wrote:
> Hello all,I think they don't teach enough analysis in school. How are you using
> I am trying to figure out a way to do something in Perl, and would
> appreciate y'alls opinion.
> I have a Perl script that I run each night to gather computer
> information from the workstations on my network. It collects the
> Windows NetBIOS name, the IP address and the MAC address, then dumps
> this info into a tab-delimited file, one record on each line.
> I would like to improve upon this functionality by having the script
> pull the previous night's information in, run the collection, then
> compare the two sets of results and update any changes to the DB.
> Reason being, right now if a machine is offline for the night, it gets
> "wiped out" from the inventory when the script is run. Whereas it
> should remain, unless the MAC address or computer name actually moves
> to a different IP.
> Now, given the relatively small amount of information gathered right
> now, I think a flat file is fine. However, if someone can point me at
> a simple database that is easily implemented in Perl, that would be
> great too.
> What do you all think? Flat file or database?
this data? Do you, most of the time, look up single records? Or do you
use it all to create a report or a statistical summary? Databases work
best when most of the work is looking up a single (or a small set) of
records. If you use all the data, a flat file takes up less disk space
and is faster.
I would have one array in my program that contained all the records and
use tie (see `perldoc -f tie`) to give it persistency. That way, if a
machine cannot be contacted, its old record remains.
Just my 0.00000002 million dollars worth,
"For the things we have to learn before we can do them, we learn by doing them."
* Perl tutorials at http://perlmonks.org/?node=Tutorials
* A searchable perldoc is at http://perldoc.perl.org/