Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

access speed, perl binary hash file vs mySQL

Tags:

mysql

perl

I currently use a lot of perl binary hash files stored in multiple file locations for loading data into this cgi website. I am debating whether mySQL would be faster or slower if I decide to store my data there.

Any insights? I understand that perl hashes are completely loaded into memory.

Gordon

like image 610
Gordon Avatar asked Dec 22 '22 17:12

Gordon


2 Answers

Using a database means your lookups will be slower but your script will use less memory.

Using in-memory hashes means your lookups will be faster but your script will use more memory.

If you're not having memory troubles and your hashes will never get larger, then continue to use them.

If you're not having memory troubles and your hashes will get larger, then look into using a database.

If you're having memory troubles, use a database.

If you want to use a database for the sake of using a database (i.e. to learn new skills) then use a database.

like image 107
CanSpice Avatar answered Dec 29 '22 22:12

CanSpice


If a Perl hash handles your data needs, you probably don't need the overhead of a full blown SQL database. There are a lot of storage alternatives for key->value storage such as the Berkley DB and the entire "NOSQL" movement. Google those and you'll find lots of info. Perl interfaces exist in CPAN for many of these.

like image 36
Bill Ruppert Avatar answered Dec 29 '22 22:12

Bill Ruppert