I created my fetch index in my model and I forced a migration. How do I check if the index exists and is used by the fetch request of my FetchedResultsController?
How do I check if a fetch index actually got created?
if you want to dig into the SQLite query plan, you can use -com.apple.CoreData.SQLDebug 4 as a user default or process launch argument and we'll print both the sql and the query plan to the log. That will be authoritative, but the query plans can be a bit difficult to read. If you post it here, we can help decipher it.
Is that enough?
CoreData: sql: SELECT t0.Z_ENT, t0.Z_PK FROM ZMESSAGE t0 WHERE t0.ZCONVERSATION = ? ORDER BY t0.ZDATE, t0.ZREMOTESENTDATE
CoreData: details: SQLite bind[0] = (int64)30
CoreData: annotation: sql connection fetch time: 0.0003s
CoreData: annotation: fetch using NSSQLiteStatement <0x281075900> on entity 'Message' with sql text 'SELECT t0.Z_ENT, t0.Z_PK FROM ZMESSAGE t0 WHERE t0.ZCONVERSATION = ? ORDER BY t0.ZDATE, t0.ZREMOTESENTDATE' returned 1 rows with values: (
"0xfbf19df6af6597b6 <x-coredata://ECC5058A-17B0-4D54-B1B8-99557948A8B1/TextMessage/p11847>"
)
CoreData: annotation: total fetch execution time: 0.0006s for 1 rows.
CoreData: details: SQLite: EXPLAIN QUERY PLAN SELECT t0.Z_ENT, t0.Z_PK FROM ZMESSAGE t0 WHERE t0.ZCONVERSATION = ? ORDER BY t0.ZDATE, t0.ZREMOTESENTDATE
4 0 0 SEARCH TABLE ZMESSAGE AS t0 USING INDEX Z_Message_conversation_date_remoteSentDate (ZCONVERSATION=?)
CoreData: details: Bound intarray value 11847 at 0
CoreData: annotation: Bound intarray values.
I might have figured it out: Does 4 0 0 SEARCH TABLE ZMESSAGE AS t0 USING INDEX Z_Message_conversation_date_remoteSentDate (ZCONVERSATION=?) mean it is querying the index?