当前位置: 首页 > 工具软件 > Insql > 使用案例 >

SQL优化(in)

公良奇
2023-12-01

SQL优化(in)

in 语句

耗时:0.58s

// An highlighted block
SELECT
	V.ID,
	V.P_ID,
	V.NO,
	V.NAME,
	V.TYPE,
	V.DIS_LEVEL 
FROM V_MES_DEVICE_TREE_FFI V WHERE V.P_ID IN
	( SELECT v.ID FROM V_MES_DEVICE_TREE_FFI v
	 WHERE v.P_ID = '21601_T01**5a640d296c262391e053070ca80a3842' )

优化后

耗时:0.05s

// An highlighted block
SELECT
	V.ID,
	V.P_ID,
	V.NO,
	V.NAME,
	V.TYPE,
	V.DIS_LEVEL 
FROM
	( SELECT v.ID FROM V_MES_DEVICE_TREE_FFI v
	 WHERE v.P_ID = '21601_T01**5a640d296c262391e053070ca80a3842' ) t
LEFT JOIN V_MES_DEVICE_TREE_FFI V ON t.ID = V.P_ID
 类似资料: