CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
How to create a table using hash or array of hashes

 

First page Previous page 1 2 Next page Last page  View All


Tejas
User

Jan 21, 2015, 6:36 AM

Post #26 of 28 (300 views)
Re: [FishMonger] How to create a table using hash or array of hashes [In reply to] Can't Post

Yeah
That is the only way
But if files are sorted then this is even more rapid
I will have to arrange the files this way then
Currently I'm using the DB approach only
Just thought of having a script .
Thanks
Tejas


Laurent_R
Veteran / Moderator

Jan 21, 2015, 10:00 AM

Post #27 of 28 (293 views)
Re: [FishMonger] How to create a table using hash or array of hashes [In reply to] Can't Post


In Reply To
A faster approach would be to load the csv files into a database and leverage the power of sql statements to query/extract the info.


I have to disagree with that. A hash is orders of magnitude faster than a database. In various tests that I made, as well as tests made by others, loading a hash is at least 10 times faster than loading a DB. And querying a hash is about 30 times faster than on a mySQL DB sitting on ramdisk. If the DB is on disk, then DB performances are even much worse.

The only advantage of a SQL DB is that is is somewhat easier to make complicated queries.

On the other hand, when the data is really huge, the hash might not fit into memory. I have this problem quite often, then I am sorting the records of both files and compare them in parallel -- much much faster than a DB.


Tejas
User

Jan 21, 2015, 10:23 AM

Post #28 of 28 (285 views)
Re: [Laurent_R] How to create a table using hash or array of hashes [In reply to] Can't Post

Hi FishMonger

Right now, I am using the DB approach, as i just want to check the existence and now that i am understading perl a bit.
I could figure out what you excatly are doing to compare the files after sorting.

Quote
You have posted this code in another thread , i saved it in my system though


Now, Iam going through the object oriented concepts of perl .
And Thinking of a best way to learn it.

A Small Problem Set is

Quote
1. I have a csv file
2 And I have to query three databases for each line.


Can this be used as a small problem statement to understand OO perl

I am a c++ prgrammer and i understand the oo concepts well. so i can grasp the concepts pretty quick and oo perl seems to be a bit different in syntax which is the call of duty at the moment for me.


Can you explain me theoritically how to conquer this problem in an object oriented way , if it makes any sense :)

Thanks
Tejas


(This post was edited by Tejas on Jan 21, 2015, 10:24 AM)

First page Previous page 1 2 Next page Last page  View All
 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives