Hi, ALL,
1. I am working with C++ using C API to access the DB.
What I did was:

upon startup - read the data in the std::vector<>, then use
std::sort() to sort this vector appropriately.

Now, today it hit me that I can use "ORDER BY" SELECT clause to
retrieve data as pre-sorted.

What is best practice here? Should I use "ORDER BY" or leave my code as it is?

2.
sqlite> EXPLAIN QUERY PLAN SELECT players.playerid FROM players WHERE players.na
me = "Igor Korot" AND players.age = 25 AND players.teamid = (SELECT teamid FROM
teams WHERE teams.name = "SF");
selectid|order|from|detail
0|0|0|SCAN TABLE players (~1000 rows)
0|0|0|EXECUTE SCALAR SUBQUERY 1
1|0|0|SEARCH TABLE teams USING AUTOMATIC COVERING INDEX (name=?) (~7 rows)

players table does not have any indexes yet.
What index needs to be created? (name, age, teamid) IIUC, right?

Thank you.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to