SQL执行效率问题
44万数据测试
两个存储过程内容如下:
1、
select note from table where cityID='1'
2、
WITH temp AS
(
SELECT * FROM city WHERE cityid=1
UNION ALL
SELECT city .* FROM city
INNER JOIN temp ON city .professionParent=temp.cityid
)
SELECT table .note FROM table
INNER JOIN temp ON table .cityid=temp.cityid
那个执行速度最快
两个存储过程内容如下:
1、
select note from table where cityID='1'
2、
WITH temp AS
(
SELECT * FROM city WHERE cityid=1
UNION ALL
SELECT city .* FROM city
INNER JOIN temp ON city .professionParent=temp.cityid
)
SELECT table .note FROM table
INNER JOIN temp ON table .cityid=temp.cityid
那个执行速度最快