user907729
user907729

Reputation:

Join on 3 different table takes time to fetch data

I am applying join query to fetch data from database on my iPhone app.
See my query
"select A.a1, A.a2, B.b1, B.b2, C.c1, C.c2, from A LEFT OUTER JOIN B ON A.a3 = B.b3 AND A.a4 = B.b4 LEFT OUTER JOIN C ON A.a5 = C.c3 Where A.a6 = '%@'"

Here A contains more than 30K records, B has 20K records and C contains 200 records. Is there any way to reduce the time taken to fetch the data?

NOTE : This query returns correct result.

Upvotes: 1

Views: 152

Answers (2)

Nimit Parekh
Nimit Parekh

Reputation: 16864

In this case, you can use column indexes in the table. Following links point to as to how to create the indexes in Sqlite database.

  1. creating the index
  2. Same question answered here.

This might help you.

Upvotes: 0

Karthikeyan Arumugam
Karthikeyan Arumugam

Reputation: 330

did you tried indexing Table A ? if not try it.. it might be a way to reduce the time to fetch data.. Warning : using Index in wrong place may affect your performance

Upvotes: 0

Related Questions