摘要:
The SQLite Query Planner This document provides overview of how the query planner and optimizer for SQLite works. Given a single SQL statement, there might be dozens, hundreds, or even thousands of ways to implement that statement, depending on the complexity of the statement itself and of the 阅读全文
摘要:
SQLite是个典型的嵌入式DBMS,它有很多优点,它是轻量级的,在编译之后很小,其中一个原因就是在查询优化方面比较简单,它只是运用索引机制来进行优化的,经过对SQLite的查询优化的分析以及对源代码的研究,我将SQLite的查询优总结如下:一、影响查询性能的因素:1.对表中行的检索数目,越小越好2.排序与否。3.是否要对一个索引。4.查询语句的形式二、几个查询优化的转换1.对于单个表的单个列而言,如果都有形如T.C=expr这样的子句,并且都是用OR操作符连接起来,形如: x = expr1 OR expr2 = x OR x = expr3 此时由于对于OR,在SQLite中不能利用索引来 阅读全文