Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Clarification and typo fixes in the NGQP document. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
a5a0ee107dad54f83f0244e9e3ae674f |
User & Date: | drh 2013-08-23 16:37:14.766 |
Context
2013-08-25
| ||
23:48 | Change the 3.8.0 release date to 2013-08-26. (check-in: 105ed6eed2 user: drh tags: trunk) | |
2013-08-23
| ||
16:37 | Clarification and typo fixes in the NGQP document. (check-in: a5a0ee107d user: drh tags: trunk) | |
16:16 | Fix documentation typos. (check-in: ce2a4ec1e7 user: drh tags: trunk) | |
Changes
Changes to pages/queryplanner-ng.in.
︙ | ︙ | |||
62 63 64 65 66 67 68 | But as applications and schemas and queries grow more complex, a clever query planner can greatly speed and simplify the work of application development. There is amazing power in being about to tell the database engine what content is desired, and then let the database engine figure out the best way to retrieve that content.</p> | | | | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | But as applications and schemas and queries grow more complex, a clever query planner can greatly speed and simplify the work of application development. There is amazing power in being about to tell the database engine what content is desired, and then let the database engine figure out the best way to retrieve that content.</p> <p>Writing a good query planner is more art than science. The query planner must work with incomplete information. It cannot determine how long any particular plan will take without actually running that plan. So when comparing two or more plans to figure out which is "best", the query planner has to make some guesses and assumption and those guesses and assumptions will sometimes be wrong. A good query plan is one that will find the correct solution often enough that application programmers rarely need to get involved.</p> <h3>2.1 Query Planning In SQLite</h3> <p>SQLite computes joins using nested loops, one loop for each table in the join. (Additional loops might be inserted for IN and OR operators in the WHERE clause. SQLite considers those too, |
︙ | ︙ | |||
324 325 326 327 328 329 330 | R-N1-C (cost: 13.43) <br> R-N1-P (cost: 14.74) <br> R-N2-S (cost: 15.08) <br> </blockquote> <p>And so forth. There are 8 nodes in the TPC-H Q8 query, so this process repeats a total of 8 | | | 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | R-N1-C (cost: 13.43) <br> R-N1-P (cost: 14.74) <br> R-N2-S (cost: 15.08) <br> </blockquote> <p>And so forth. There are 8 nodes in the TPC-H Q8 query, so this process repeats a total of 8 times. In the general case of a K-way join, the storage requirement is O(N) and the computation time is O(K*N), which is significantly faster than the O(2<small><sup>K</sup></small>) exact solution.</p> <p>But what value to choose for N? One might try N=K. This makes the algorithm O(K<small><sup>2</sup></small>) which is actually still quite efficient, since the maximum value of K is 64 and K rarely exceeds 10. |
︙ | ︙ |