什么是自动覆盖索引? [英] What is an automatic covering index?

查看:70
本文介绍了什么是自动覆盖索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 SQLite 3 中使用 EXPLAIN QUERY PLAN 时,它有时会给我输出,例如

When using EXPLAIN QUERY PLAN in SQLite 3 it sometimes gives me output such as

SEARCH TABLE staff AS s USING AUTOMATIC COVERING INDEX (is_freelancer=? AND sap=?) (~6 rows)

索引从何而来,它有什么作用?该表没有手动创建的索引.

Where does the index come from and what does it do? The table has no manually created indices on it.

推荐答案

"Automatic" 表示 SQLite 创建一个临时索引,仅用于该查询,之后删除.

"Automatic" means that SQLite creates a temporary index that is used only for this query, and deleted afterwards.

当估计创建索引的成本小于在没有索引的情况下在表中查找记录的成本时,就会发生这种情况.

This happens when the cost of creating the index is estimated to be smaller than the cost of looking up records in the table without the index.

(A 覆盖索引是包含所有要读取的列的索引,这意味着不需要在表中查找索引条目对应的记录.)

(A covering index is an index that contains all the columns to be read, which means that the record corresponding to the index entry does not need to be looked up in the table.)

这篇关于什么是自动覆盖索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆