SQL 查询优化:根据平台类型统计特定时间段内的崩溃次数
{ "title": "SQL 查询优化:根据平台类型统计特定时间段内的崩溃次数", "description": "本文介绍如何优化 SQL 查询,根据平台类型统计特定时间段内的崩溃次数,并提供更简洁高效的查询语句。", "keywords": "SQL 查询优化, 崩溃统计, 平台类型, 时间段, log_iMonkey_Wechat_overview, log_iOS_crash, log_android_crash", "content": ""SELECT PlatformType AS PlatformType, (CASE WHEN PlatformType IN (1, 3, 5, 7) THEN (SELECT COUNT(uuid) FROM log_iOS_crash WHERE uuid = CrashIdentifier AND Ds >= toDateTime('#day_wechat_crash_time.start#') AND Ds <= toDateTime('#day_wechat_crash_time.end#')) WHEN PlatformType IN (2, 4, 6, 8) THEN (SELECT COUNT(uuid) FROM log_android_crash WHERE uuid = CrashIdentifier AND Ds >= toDateTime('#day_wechat_crash_time.start#') AND Ds <= toDateTime('#day_wechat_crash_time.end#')) ELSE 0 END) AS index_crashcount_0 FROM log_iMonkey_Wechat_overview WHERE Debug = 0 AND PlatformType != 0 AND CrashIdentifier != '' AND Ds >= toDateTime('#day_wechat_crash_time.start#') AND Ds <= toDateTime('#day_wechat_views_time.end#') GROUP BY PlatformType ORDER BY index_crashcount_0 DESC LIMIT 5000" }
原文地址: https://www.cveoy.top/t/topic/pIJP 著作权归作者所有。请勿转载和采集!