title: Faster SQL data retrival with Java and search large data
body: <p>I have a table with over 100 thousand data consisting of number pairs. A sample of which is shown below.</p>
  
  <pre><code>   A          B
     0010     0010 
      0010     0011 
      0010     0019 
      0010     0056
      0011     0010 
      0011     0011 
      0011     0019 
      0011     0040
      0019     0010
      0019     0058 
  </code></pre>
  
  <p>Here the numbers in Column A has possible pairs present in column B. 
  Explanation : User will have several of these numbers ranging form 10 -100. Now as we can see for 0010 - 0011 and 0019 is present. So if the user has a list containing 0010 along with 0011 a warning will be shown that this pair is not allowed and vice versa.</p>
  
  <p>How to approach this in Java?
  Loading the hash map with all the data doesnot seem to be a good option although the search will be much faster.</p>
  
  <p>please suggest. Thanks  </p>
  
  <p>Testcase:</p>
  
  <pre><code>num = 0010;  //value from list which user will be passing
  test(num){
  if(num.equals("0019")||num.equals("0011")) //compairing with database 
  System.out.println("incompatible pair present");
  }
  </code></pre>
  
  <p>The above example is a very simple pseudo code. The actual problem will me much more complex.</p>