SQL_ID 4g70n3k9bqc5v, child number 0 ------------------------------------- MERGE INTO YJBZH_GRXDFHZMXJL GRXDFHZMXJL USING ( SELECT A.AGMT_ID AS AGMT_ID, B.CUST_NAME AS CUST_NAME FROM DWF.F_AGT_CADB_BOOK_H A, DWF.F_AGT_SAVB_BASICINFO_H B WHERE A.STAR…
今天写了一个统计sql,在一个近亿条数据的表上执行,200s都查不出结果.SQL如下: select customer,count(1) c from upv_** where created between "2015-07-06" and "2015-07-07" group by customer having c > 20 order by c desc 执行explain,发现这个sql扫描了8000W条记录到磁盘上.然后再进行筛选.type=ind…
[转自:https://blog.csdn.net/bruce128/article/details/46777567]并进行总结 今天写了一个统计sql,在一个近亿条数据的表上执行,200s都查不出结果.SQL如下: ) c from upv_** where created between "2015-07-06" and "2015-07-07" group by customer having c > order by c desc 执行explain…
数据库环境:SQL SERVER 2005 我们来看一下SQL语句及对应的数据量 SELECT COUNT(*) FROM cinvout_02 a WHERE ( a.dept_id IN ( SELECT RTRIM(dept_id) FROM ctlm2320 ' AND zone_id = '' ) OR a.dept_id = '' OR ( a.dept_id IN ( SELECT RTRIM(b.dept_id) FROM ctlm2320 a , ctlm1003 b WHER…