I'm using https://github.com/litehelpers/Cordova-sqlite-storage in a cordova project. I'm using it to store data in the following table:
$cordovaSQLite.execute(db, 'CREATE TABLE IF NOT EXISTS condicions (key text primary key, value blob)');
The table has 1296 rows like this:
KEY VALUE (trimmed)
-----------------------------------------------------------
E1-E-6500-amb més de 100 m2 {\"Canvi calefac...
E1-E-9250-amb més de 100 m2 {\"Canvi calefac...
E1-F-4500-amb menys de 50 m2 {\"Canvi calefac...
E1-F-8250-amb menys de 50 m2 {\"Canvi calefac...
E1-F-2500-entre 50 i 100 m2 {\"Canvi calefac...
E1-F-7250-entre 50 i 100 m2 {\"Canvi calefac...
E1-F-10000-entre 50 i 100 m2 {\"Canvi calefac...
E1-F-5500-amb més de 100 m2 {\"Canvi calefac...
E1-F-9000-amb més de 100 m2 {\"Canvi calefac...
E1-G-3500-amb menys de 50 m2 {\"Canvi calefac...
E1-G-7500-amb menys de 50 m2 {\"Canvi calefac...
E1-G-11000-amb menys de 50 m2 {\"Canvi calefac...
E1-G-6500-entre 50 i 100 m2 {\"Canvi calefac...
E1-G-9250-entre 50 i 100 m2 {\"Canvi calefac...
Values are trimmed as they are very large jsons. Then I'm doing the following SELECT:
var query = 'SELECT * FROM condicions WHERE key=?';
$cordovaSQLite.execute(db, query, [hash]).then(function(res) {
This query is very slow, but after a while repeating it, it turns fast. Is there any reason? (I'm thinking in something like cache or similar...). Is there any way to turn it fast all times?