SQLite Forum

Best way to use carray
Login
Hello

I have a table foo:

CREATE TABLE foo (
  sourceId INTEGER,
  data TEXT,
  id INTEGER PRIMARY KEY,
);

Now I query the table by

SELECT id, data FROM foo WHERE sourceId IN carray(?1)

The carray is normally a smaller subset but sometimes it can be a really large subset too. After looking into the carray source my understanding is that there is no index optimization. I am not sure if Sqlite is maybe creating a temporary index. Would be there an advantage to provide a sorted_carray implementation?

Best regards, Marco