我在所有3个缓存中上传了点燃3缓存中的数据和总数据大约100万。而我在其上运行查询我得到1s的结果并且它生成在查询计划下面
SELECT DISTINCT
A3.VAL2 AS __C0
FROM DPHAF.DPHAF A1
/* DPHAF.DPHAF.__SCAN_ */
/* WHERE (A1.VAL0 = 'dg~')
AND ((A1.PROP6 = '1oh~#has_single_bond')
AND (A1.PROP0 = '4xm~#type'))
*/
INNER JOIN DS_AF.DS_AF S1
/* DS_AF."prop_asc_entity_asc_elem_asc_typ_asc_idx": PROP = A1.PROP6
AND ENTITY = A1.ENTRY
*/
ON 1=1
/* WHERE (A1.PROP6 = S1.PROP)
AND (A1.ENTRY = S1.ENTITY)
*/
INNER JOIN DPHAF.DPHAF A2
/* DPHAF."entry_asc_idx": ENTRY = S1.ELEM */
ON 1=1
/* WHERE (S1.ELEM = A2.ENTRY)
AND ((A2.PROP0 = '4xm~#type')
AND ((A2.PROP6 = '1oh~#has_single_bond')
AND (A2.VAL0 = '7a~')))
*/
INNER JOIN DS_AF.DS_AF S2
/* DS_AF."prop_asc_entity_asc_elem_asc_typ_asc_idx": PROP = A2.PROP6
AND ENTITY = A2.ENTRY
*/
ON 1=1
/* WHERE (A2.PROP6 = S2.PROP)
AND (A2.ENTRY = S2.ENTITY)
*/
INNER JOIN DPHAF.DPHAF A3
/* DPHAF."entry_asc_idx": ENTRY = S2.ELEM */
ON 1=1
WHERE (A3.PROP2 = '1oh~#is_atom_of')
AND ((A3.VAL0 = '7a~')
AND ((A3.PROP0 = '4xm~#type')
AND ((S2.ELEM = A3.ENTRY)
AND ((A2.PROP6 = S2.PROP)
AND ((A2.PROP6 = '1oh~#has_single_bond')
AND ((A2.ENTRY = S2.ENTITY)
AND ((A2.VAL0 = '7a~')
AND ((A2.PROP0 = '4xm~#type')
AND ((S1.ELEM = A2.ENTRY)
AND ((A1.PROP6 = S1.PROP)
AND ((A1.PROP6 = '1oh~#has_single_bond')
AND ((A1.ENTRY = S1.ENTITY)
AND ((A1.PROP0 = '4xm~#type')
AND (A1.VAL0 = 'dg~'))))))))))))))
LIMIT 1000
SELECT DISTINCT
__C0 AS VAL2
FROM PUBLIC.__T0
/* DPHAF."merge_scan" */
LIMIT 1000
正如您所注意到这里有完整的缓存扫描/ * DPHAF.DPHAF .__ SCAN_ * /
之后,当我们在DPHAF组索引上添加索引时,它将为我们提供以下计划
SELECT
A1.VAL2 AS __C0
FROM DPHAF.DPHAF A1
/* DPHAF."prop0_asc_val0_asc_idx": VAL0 = '7a~'
AND PROP0 = '4xm~#type'
*/
/* WHERE (A1.PROP0 = '4xm~#type')
AND ((A1.PROP2 = '1oh~#is_atom_of')
AND ((A1.VAL0 = '7a~')
AND ((A1.VAL5 = '3')
AND ((A1.PROP8 = '1oh~#has_double_bond')
AND (A1.PROP6 = '1oh~#has_single_bond')))))
*/
INNER JOIN DPHAF.DPHAF A3
/* DPHAF."prop0_asc_val0_asc_idx": VAL0 = '7a~'
AND PROP0 = '4xm~#type'
*/
ON 1=1
/* WHERE (A3.PROP0 = '4xm~#type')
AND ((A3.VAL5 = '1')
AND (A3.VAL0 = '7a~'))
*/
INNER JOIN DPHAF.DPHAF A4
/* DPHAF."prop0_asc_val0_asc_idx": VAL0 = '562~'
AND PROP0 = '4xm~#type'
*/
ON 1=1
/* WHERE (A4.PROP0 = '4xm~#type')
AND ((A4.VAL5 = '1')
AND (A4.VAL0 = '562~'))
*/
INNER JOIN DS_AF.DS_AF S1
/* DS_AF."prop_asc_entity_asc_elem_asc_typ_asc_idx": PROP = A1.PROP6
AND ENTITY = A1.ENTRY
*/
ON 1=1
/* WHERE (A1.PROP6 = S1.PROP)
AND (A1.ENTRY = S1.ENTITY)
*/
INNER JOIN DPHAF.DPHAF A2
/* DPHAF."entry_asc_idx": ENTRY = S1.ELEM */
ON 1=1
/* WHERE (S1.ELEM = A2.ENTRY)
AND ((A2.VAL5 = '1')
AND (A2.VAL0 = '562~'))
*/
INNER JOIN DS_AF.DS_AF S2
/* DS_AF."prop_asc_elem_asc_entity_asc_typ_asc_idx": ELEM = A3.ENTRY
AND PROP = A1.PROP6
AND ENTITY = A1.ENTRY
*/
ON 1=1
/* WHERE (A1.ENTRY = S2.ENTITY)
AND ((S2.ELEM = A3.ENTRY)
AND (A1.PROP6 = S2.PROP))
*/
INNER JOIN DS_AF.DS_AF D1
/* DS_AF."prop_asc_elem_asc_entity_asc_typ_asc_idx": ELEM = A4.ENTRY
AND PROP = A1.PROP8
AND ENTITY = A1.ENTRY
*/
ON 1=1
WHERE (A4.VAL5 = '1')
AND ((A4.VAL0 = '562~')
AND ((A4.PROP0 = '4xm~#type')
AND ((D1.ELEM = A4.ENTRY)
AND ((A1.PROP8 = D1.PROP)
AND ((A1.PROP8 = '1oh~#has_double_bond')
AND ((A1.ENTRY = D1.ENTITY)
AND ((A3.VAL5 = '1')
AND ((A3.VAL0 = '7a~')
AND ((A3.PROP0 = '4xm~#type')
AND ((S2.ELEM = A3.ENTRY)
AND ((A1.PROP6 = S2.PROP)
AND ((A1.ENTRY = S2.ENTITY)
AND ((A2.VAL5 = '1')
AND ((A2.VAL0 = '562~')
AND ((S1.ELEM = A2.ENTRY)
AND ((A1.PROP6 = S1.PROP)
AND ((A1.PROP6 = '1oh~#has_single_bond')
AND ((A1.ENTRY = S1.ENTITY)
AND ((A1.VAL5 = '3')
AND ((A1.VAL0 = '7a~')
AND ((A1.PROP2 = '1oh~#is_atom_of')
AND (A1.PROP0 = '4xm~#type'))))))))))))))))))))))
SELECT
__C0 AS VAL2
FROM PUBLIC.__T0
/* DPHAF."merge_scan" */
在这里你可以看到我们没有DPHAF的完整扫描,但我的查询运行的时间太长或无限,所以我做错了什么? 感谢