How much slower? A 5-10% slowdown is expected due to the overhead of encrypting and decrypting pages.
Make sure your queries are supported by good indexes, since otherwise queries will have to scan the entire database which incurs much more I/O and decryption. (Use the Query.explain method to get a description of the query, and watch out for any SCAN operations in the output.)
Also, what device/hardware? You may be testing on a device that doesn’t have hardware acceleration of AES cryptography, although that should be unlikely nowadays.
It’s slowing application around 400-500% as a query is taking 4 seconds with encryption and takes less than a second without encryption.
Encryption with Indexes improves a little bit around 3.5 seconds to execute the query.
Multiple indexes can slowdown writing in the database as per Couchbase lite documents. Will it make syncing slow?
We are using the Samsung Active Tab 2 device which has hardware ARM Cortex-A53. and according to the below article, This has Armv8-A Cryptographic Extension which provides instructions for the acceleration of encryption and decryption.
I am new on Encryption things, please correct me if I am wrong and If you need anything from me, please.
SELECT fl_result(fl_value(body, ‘ReservationPersonID’)) FROM kv_default WHERE (fl_value(body, ‘type’) = ‘PersonStatus’ AND (fl_value(body, ‘IsValidationSuccessful’) = 1 AND ((1556582400000 BETWEEN fl_value(body, ‘StartDateEpoch’) AND fl_value(body, ‘EndDateEpoch’) AND 1556063999999 != fl_value(body, ‘EndDateEpoch’)) AND 1556582400000 != fl_value(body, ‘StartDateEpoch’)))) AND (flags & 1) = 0 ORDER BY fl_value(body, ‘ValidationStatusDateEpoch’) DESC LIMIT MAX(0, 5)
SCAN TABLE kv_default means no index is being used; the query has to read every single document into memory to check it. That’s bad.
What indexes to add depends on your data set, but an index on type is usually a good idea. You probably also want an index on StartDateEpoch; indexing (StartDateEpoch, EndDateEpoch) instead might work slightly better.
How many documents of that type are there in the db? And about how large are they? (Very large documents can slow things down, as the whole document has to be read from storage.)
@borrrden, do you know if the AES operations in SEE are hardware-accelerated in Android? That is, do they call into the OS (as on iOS) or are they implemented in the SEE source code?
On indexing vs not indexing — its a trade-off, and you’ll have to decide whether it’s worth it. But each index should only slow down insertions a little bit, so it’s usually good to index if the query is being run often.