The list of check-ins is computed by a single query. But that query then tosses the list over the wall to another subsystem which generates content for each check-in. And several queries are required for each check-in to extract the relevant information needed for display.
The timeline example above is an information-rich page. Perhaps it could be generated using fewer than 200 SQL statements. But SQL against an SQLite database is so cheap that it has never really been a factor. You can see at the bottom of the page that it was generated in about 25 milliseconds. Profiling indicates that very few of those 25 milliseconds were spent inside the database engine.
Perhaps the take-away is that when the SQL engine is in-process and queries do not involve a server round-trip, the "n+1 query problem" is not really a problem.
A complete log of the 200+ SQL statements used in generating the page above can be seen at http://sqlite.org/tmp/timeline-sql-log.html
The list of check-ins is computed by a single query. But that query then tosses the list over the wall to another subsystem which generates content for each check-in. And several queries are required for each check-in to extract the relevant information needed for display.
The timeline example above is an information-rich page. Perhaps it could be generated using fewer than 200 SQL statements. But SQL against an SQLite database is so cheap that it has never really been a factor. You can see at the bottom of the page that it was generated in about 25 milliseconds. Profiling indicates that very few of those 25 milliseconds were spent inside the database engine.