Date post: | 06-Jan-2017 |
Category: |
Technology |
Upload: | leonardo-yonguk-kim |
View: | 2,352 times |
Download: | 1 times |
String query = "SELECT " + Owner.NAME + ", " + Dog.NAME + ", " + City.NAME + " FROM " + Owner.TABLE_NAME
+ " INNER JOIN " + Dog.TABLE_NAME + " ON " + Owner.DOG_ID + " = " + Dog.ID
+ " INNER JOIN " + City.TABLE_NAME + " ON " + Owner.CITY_ID + " = " + City.ID
+ " WHERE " + Owner.NAME = "'" + escape(queryName) + "'";
Traditional data structure
Column-based data structure
• Padding bits are not needed anymore. • Queries for columns help the cache hit rate. • Boolean type fields are put into integers field. • Other fields are packaged as 1, 2, 4, 8, 16, 32, 64bits. • More space efficient than SQLite (~50%)
Link queries
RealmResults<Contact> contacts = realm.where(Contact.class).equalTo("emails.active", true).findAll();