title: What local database do I use with React Native?
body: <p>I'm new to react native and I need a list of local database tools that will meet the minimum criteria in the description to follow.</p>
  
  <p>If this were a PHP/MySQL application, I build 3 database tables:</p>
  
  <pre><code>t_food (500 rows)
  - food_id (primary_key)
  - food_name (string)
  
  t_meal (100 000 rows)
  - meal_id (primary_key)
  - meal_name (string)
  
  t_meal_item (1 000 000 rows)
  - meal_id (foreign_key)
  - food_id (foreign_key)
  </code></pre>
  
  <p>These three tables combined in MySQL takes up about 10MB to 15MB. Then I would use PHP to create an interface that will present the results of this query:</p>
  
  <pre><code>SELECT meal_id FROM t_meal_item WHERE food_id = @food1 AND meal_id IN (SELECT meal_id FROM t_meal_item WHERE food_id = @food2 AND meal_id IN (SELECT meal_id FROM t_meal_item WHERE food_id = @food3))
  </code></pre>
  
  <p>In a MySQL/PHP application, the results of the SQL query will return in less than 2 seconds.</p>
  
  <p>In the react-native world, I need a local database that achieves similar results to above but must also comply with the following requirements:</p>
  
  <ol>
  <li><p>must support 15 MB of persistent storage (so that you can use it without internet access)</p></li>
  <li><p>querying for a meal filtered by 3 food items must complete in less than 3 seconds on modern mainstream mobile devices.  Eg. the equivalent of the SQL query above must complete in less than 3 seconds on an iphone 6 and Huawei Nova Plus.</p></li>
  </ol>
  
  <p>I have already tried the following:</p>
  
  <p>A. Realm is failing on criteria 2 as indicated in this question here:</p>
  
  <p><a href="https://stackoverflow.com/questions/46394870/improve-the-speed-of-a-realm-query-in-react-native">Improve the speed of a realm query in react-native?</a></p>
  
  <p>A solution to the Realm question will be an acceptable answer to this question.</p>
  
  <p>B. Six years ago, I tried this with core data on an iOS device.  The iOS device kept crashing due to insufficient memory.  </p>
  
  <p>C. I'm trying SQLite Storage but already running into this problem here:</p>
  
  <p><a href="https://stackoverflow.com/questions/46459063/basic-react-native-sqlite-script-returning-undefined-which-causes-error">basic React Native SQLite script returning undefined which causes error</a></p>
  
  <p>What tools can solve this problem?</p>