I have 2 SQLite3 tables like this
table
persons (~15,000 records)
ID,
Name,
Address
ID is PK
table
OtherInfo (~10,000 records)
ID,
personID,
InfoNumber
ID is PK, personID is FK and UNIQUE
Code:
SELECT COUNT(p.ID)
FROM persons p LEFT JOIN OtherInfo oi ON oi.personID = p.ID
WHERE <cond>
SELECT p.ID, p.Name, oi.InfoNumber
FROM persons p LEFT JOIN OtherInfo oi ON oi.personID = p.ID
WHERE <cond>
Even though there is just one
InfoNumber for each person, it wasnt created in the
person table inorder to save space (in the actual table, there are many more VARCHAR fields).
But now, the LEFT JOIN query is taking a whole lot of time, so I may have to restructure the tables to have all fields in a single table.
But is there a way out for the LEFT JOIN query ?
Thanks