因此,我有一个相对简单的查询,它对11个不同列的值进行求和。查询本身运行得非常快,但按11列分组似乎非常慢。
这是一个解释文件的摘录,它显示查询运行了2秒,但是花费了将近17秒对数据进行分组。有什么可以优化的吗?
Query statistics:
-----------------
Table map :
----------------------------
Internal name Table name
----------------------------
t1 ustroj
t2 tfinkbilanca
t3 tfinkkontogodina
t4 tbaseanalitikanaziv
type table rows_prod est_rows rows_scan time est_cost
-------------------------------------------------------------------
scan t1 77 12 77 00:00.00 2
type table rows_prod est_rows rows_scan time est_cost
-------------------------------------------------------------------
scan t2 76231 77376 76231 00:00.36 90
type table rows_prod est_rows rows_scan time est_cost
-------------------------------------------------------------------
scan t3 152462 19203 76231 00:00.67 1
type rows_prod est_rows time est_cost
-------------------------------------------------
nljoin 152462 41266 00:01.05 337835
type rows_prod est_rows time est_cost
-------------------------------------------------
nljoin 76231 644 00:01.08 37456
type table rows_prod est_rows rows_scan time est_cost
-------------------------------------------------------------------
scan t4 151780 33 75890 00:00.77 0
type rows_prod est_rows time est_cost
-------------------------------------------------
nljoin 76231 632 00:01.86 38828
type rows_prod est_rows rows_cons time
-------------------------------------------------
group 15158 316 76231 00:16.55
type rows_sort est_rows rows_cons time
-------------------------------------------------
sort 55 316 15158 00:16.93发布于 2013-12-30 19:29:31
首先,我建议您验证查询“保存”到临时表(包括into temp tmp01 with no log)的时间,在不更改时间的注释中回答该表。
考虑到提到的大字段(char(256))是对某事的描述,我的建议是:
如果他们真的对你有用的话请接受这个答案..。如果有用,但不能解决问题,则只为其设置+1
https://stackoverflow.com/questions/20837431
复制相似问题