Well, to explain the problem-question ...
I have:
One Big DB table is populated with millions of records (each record may contain n columns).
Concept:
I want to show the web interface two lists (for example, "Available" and "Selected"). When a user moves an entry from one list to another, I need to store a temporary unique identifier (row type) of the record in the "Unknown data structure" with the name "selected" on my server and when the user finally clicks the "Send" button I will transfer this list next to another application.
Sorting and filtering are performed in the database, and then the full amount of data (in pieces) is loaded back into java, then each record will be checked if it is selected, and will be added to the list that will be displayed in the web interface.
for each entry{ if(selected.contains(currentEntry.ID)){ selectedList.add(currentEntry) }else{ availableList.add(currentEntry) } }
The lists of selectedList and availableList will contain only a few hundred records (those that are displayed to the user, approximately on the page with a maximum number of 100-200 records), so the list of the "record" type is good enough and contains my sorting.
Problem:
The "selected" structure must contain many thousands of identifiers (sometimes this can reach millions (s)).
Necessity:
I need quick access to find if id (struct.contains (id)) exists, so I will definitely use a hash structure. I need a structure that will use minimal memory resources.
Not necessary:
Good removal performance is not required. No sorting required.
source share