Skip to content

Commit b64930b

Browse files
author
hello world
committed
improve
1 parent f0fc086 commit b64930b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

202112/20211224_05.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ PostgreSQL , 热门问题
1919
## 链接、驱动、SQL
2020
2121
#### 24、为什么与检索字段类型不一致的输入条件有时可能不能采用索引?
22-
22+
https://www.bilibili.com/video/BV1ju411m7J9/
2323

2424
例如:
2525
- 被索引的字段是int4, 但是输入的where 条件是int8.
@@ -117,8 +117,8 @@ postgres=# explain select * from a where c4='1'::numeric;
117117
是否使用索引:
118118

119119
1、列出所有的同名op, 有没有op直接支持这两种类型?
120-
- 有就跳到3
121-
- 没有就跳到2
120+
- 有就跳到3, 去判断索引的ops里面有没有包含这个op.
121+
- 没有就跳到2, 去寻求隐式转换.
122122

123123
2、在这些op中, 找到与字段类型一致的op, 并且尝试将变量类型转换为op里面对应的类型. (要求存在隐式转换).
124124
例如1 `select * from a where id='1'::int8;` 要的是 `=(numeric,int8)`

0 commit comments

Comments
 (0)