I
I
Ilya Pavlovsky2016-03-21 02:12:12
Android
Ilya Pavlovsky, 2016-03-21 02:12:12

SQLite fetch from large database?

Interested in the question, how fast will the selection of 1 element from the database table, where the number of records is 10 ^ 6, 10 ^ 8 ?
Table format:

CREATE TABLE `table` (
  `text`	TEXT NOT NULL,
  `foreignKeyId`	INTEGER NOT NULL,
  PRIMARY KEY(text)
)

PS It didn't work out to google the timings, but I haven't had time to check it yet.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan Filatov, 2016-03-21
@TranE91

SELECT * FROM `table`
WHERE `text` = 'mytext'

the request will be executed instantly. because the text field is the key, which means it's in the index.
if you need to add other fields as selection criteria, add them to the index. and everything will be fast.

I
Ilya Pavlovsky, 2016-03-22
@TranE91

Yes, I checked. Sampling by indexed field takes no more than 1ms.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question