I have 2 million records on the database is it possible to bring them all and store them on perl hash reference without any problem of reaching out of memory ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
What is your reason to read them all into memory? Speed or ease of coding (i.e. treat the whole thing as a hashref).
If its the former, then sure, I think, you just need a ton of ram.
If its the latter, then there are interesting options. For example there are
tied interfaces for databases that look like Perl native hashes but in reality query and return data as needed. A quick search of CPAN showsTie::DBI,Tie::Hash::DBDand several tied interfaces for specific databases, flat-file DBs, and CSV files, including mineTie::Array::CSV.