• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

HashMap versus database

 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

What would be more efficient?

Storing around 50k to 70k rows in a hashMap and retrieving them often or to create a table in the database and retrieving.

Will it be possible to just store so many rows in the java structure ? These many objects without being garbage collected can cause an overflow right ?

~Aditya
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Adi Kulkarni wrote:
What would be more efficient?
Storing around 50k to 70k rows in a hashMap and retrieving them often or to create a table in the database and retrieving.



[i am not sure] in this case i think Database would be a better choice also read this
 
Adi Kulkarni
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks seetharaman.

But if storing 50000,70000 objects in a hashmap is possible by increasing the heap size , then retrieving those would be faster than retrieving from the database right?

~Aditya
 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Adi Kulkarni wrote:Thanks seetharaman.

But if storing 50000,70000 objects in a hashmap is possible by increasing the heap size , then retrieving those would be faster than retrieving from the database right?

~Aditya



I believe it depends on whether you need your data to be persisted for future and if the 70000 odd objects are just required for your logical processing it is better to use HashMap and they are certainly faster than the Database operations for sure.

regards,
vijay
 
Adi Kulkarni
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Vijay,

I would need the data for future. So I believe that using the database would be better though slower. Moreover my database would be a dynamic one which would be updated time to time.

~Aditya
 
Hey, I'm supposed to be the guide! Wait up! No fair! You have the tiny ad!
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic