软件下载吧文章资讯

分类分类

PostgreSQL索引扫描时为什么index only scan不返回ctid

2024-03-04 00:33作者:下载吧

我们都知道在PostgreSQL中使用索引扫描时,是通过索引中存储的ctid去表中得到数据的。同时在PostgreSQL中如果要查询的列都在索引中,我们还可以使用index only scan。

既然如此,当我们在查询中用到ctid时,是否还能使用index only scan呢?

按理来说是没有问题的,例如在Oracle中:

SQL> select rowid,id from t1 where id = 1;
—————————————————————————
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
—————————————————————————
| 0 | SELECT STATEMENT | | 1 | 25 | 1 (0)| 00:00:01 |
|* 1 | INDEX RANGE SCAN| IDX_T1 | 1 | 25 | 1 (0)| 00:00:01 |
—————————————————————————
展开全部

相关文章

说两句网友评论
    我要跟贴
    取消