哪位兄弟能不能帮看下下面的两个SQL语句,为什么前一个语句处理逻辑少,外联的表比后一个语句明显少,但是提取数据的速度
反而要比后面表慢得得多啊,很慢!!!真是快疯了,跪求哪位兄台不吝赐教啊~, 兄弟不胜感激。这个是执行速度特慢的: SELECT TOP (100) PERCENT dbo.sogame8_games.games_id, dbo.sogame8_games.games_name, dbo.sogame8_games.games_click,
dbo.sogame8_games.games_lpic,
(CASE dbo.sogame8_games.games_show WHEN 1 THEN '显示' ELSE '不显示' END) AS games_show,
dbo.sogame8_gametype.gametype_name,
(CASE dbo.sogame8_games.games_company WHEN 0 THEN '不详' ELSE dbo.sogame8_company.company_name END) AS company_name,
(SELECT COUNT(*) AS Expr1
FROM dbo.sogame8_gdetail
WHERE (gdetail_gameid = dbo.sogame8_games.games_id)) AS games_dcount, dbo.sogame8_games.games_show AS games_status
FROM dbo.sogame8_games LEFT OUTER JOIN
dbo.sogame8_gametype ON dbo.sogame8_games.games_gametype = dbo.sogame8_gametype.gametype_id LEFT OUTER JOIN
dbo.sogame8_company ON dbo.sogame8_games.games_company = dbo.sogame8_company.company_id
WHERE (dbo.sogame8_games.games_kind = 1)
ORDER BY dbo.sogame8_games.games_id DESC这个是执行很快的那个:
SELECT TOP (100) PERCENT dbo.sogame8_games.games_id, dbo.sogame8_games.games_name, dbo.sogame8_games.games_click,
dbo.sogame8_games.games_lpic,
(CASE dbo.sogame8_games.games_show WHEN 1 THEN '显示' ELSE '不显示' END) AS games_show,
dbo.sogame8_egameftype.egameftype_name, dbo.sogame8_egamestype.egamestype_name, dbo.sogame8_gametype.gametype_name,
(CASE dbo.sogame8_games.games_company WHEN 0 THEN '不详' ELSE dbo.sogame8_company.company_name END) AS company_name,
dbo.sogame8_egamestype.egamestype_floder, dbo.sogame8_games.games_egameftype, dbo.sogame8_games.games_egamestype,
(SELECT COUNT(*) AS Expr1
FROM dbo.sogame8_gdetail
WHERE (gdetail_gameid = dbo.sogame8_games.games_id)) AS games_dcount, dbo.sogame8_games.games_show AS games_status,
dbo.sogame8_gametype.gametype_ename
FROM dbo.sogame8_games LEFT OUTER JOIN
dbo.sogame8_egameftype ON dbo.sogame8_games.games_egameftype = dbo.sogame8_egameftype.egameftype_id LEFT OUTER JOIN
dbo.sogame8_egamestype ON dbo.sogame8_games.games_egamestype = dbo.sogame8_egamestype.egamestype_id LEFT OUTER JOIN
dbo.sogame8_gametype ON dbo.sogame8_games.games_gametype = dbo.sogame8_gametype.gametype_id LEFT OUTER JOIN
dbo.sogame8_company ON dbo.sogame8_games.games_company = dbo.sogame8_company.company_id
WHERE (dbo.sogame8_games.games_kind = 0)
ORDER BY dbo.sogame8_games.games_id DESC
反而要比后面表慢得得多啊,很慢!!!真是快疯了,跪求哪位兄台不吝赐教啊~, 兄弟不胜感激。这个是执行速度特慢的: SELECT TOP (100) PERCENT dbo.sogame8_games.games_id, dbo.sogame8_games.games_name, dbo.sogame8_games.games_click,
dbo.sogame8_games.games_lpic,
(CASE dbo.sogame8_games.games_show WHEN 1 THEN '显示' ELSE '不显示' END) AS games_show,
dbo.sogame8_gametype.gametype_name,
(CASE dbo.sogame8_games.games_company WHEN 0 THEN '不详' ELSE dbo.sogame8_company.company_name END) AS company_name,
(SELECT COUNT(*) AS Expr1
FROM dbo.sogame8_gdetail
WHERE (gdetail_gameid = dbo.sogame8_games.games_id)) AS games_dcount, dbo.sogame8_games.games_show AS games_status
FROM dbo.sogame8_games LEFT OUTER JOIN
dbo.sogame8_gametype ON dbo.sogame8_games.games_gametype = dbo.sogame8_gametype.gametype_id LEFT OUTER JOIN
dbo.sogame8_company ON dbo.sogame8_games.games_company = dbo.sogame8_company.company_id
WHERE (dbo.sogame8_games.games_kind = 1)
ORDER BY dbo.sogame8_games.games_id DESC这个是执行很快的那个:
SELECT TOP (100) PERCENT dbo.sogame8_games.games_id, dbo.sogame8_games.games_name, dbo.sogame8_games.games_click,
dbo.sogame8_games.games_lpic,
(CASE dbo.sogame8_games.games_show WHEN 1 THEN '显示' ELSE '不显示' END) AS games_show,
dbo.sogame8_egameftype.egameftype_name, dbo.sogame8_egamestype.egamestype_name, dbo.sogame8_gametype.gametype_name,
(CASE dbo.sogame8_games.games_company WHEN 0 THEN '不详' ELSE dbo.sogame8_company.company_name END) AS company_name,
dbo.sogame8_egamestype.egamestype_floder, dbo.sogame8_games.games_egameftype, dbo.sogame8_games.games_egamestype,
(SELECT COUNT(*) AS Expr1
FROM dbo.sogame8_gdetail
WHERE (gdetail_gameid = dbo.sogame8_games.games_id)) AS games_dcount, dbo.sogame8_games.games_show AS games_status,
dbo.sogame8_gametype.gametype_ename
FROM dbo.sogame8_games LEFT OUTER JOIN
dbo.sogame8_egameftype ON dbo.sogame8_games.games_egameftype = dbo.sogame8_egameftype.egameftype_id LEFT OUTER JOIN
dbo.sogame8_egamestype ON dbo.sogame8_games.games_egamestype = dbo.sogame8_egamestype.egamestype_id LEFT OUTER JOIN
dbo.sogame8_gametype ON dbo.sogame8_games.games_gametype = dbo.sogame8_gametype.gametype_id LEFT OUTER JOIN
dbo.sogame8_company ON dbo.sogame8_games.games_company = dbo.sogame8_company.company_id
WHERE (dbo.sogame8_games.games_kind = 0)
ORDER BY dbo.sogame8_games.games_id DESC
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货