代码之家  ›  专栏  ›  技术社区  ›  developer

提高临时表插入的性能(有很多列)

  •  0
  • developer  · 技术社区  · 7 年前

    我必须从select查询创建一个临时表#Trades。select查询返回77987行,大约有175列(varchar、numeric、small int和int的混合)。

    SELECT Col1, Col2 ... Col175 into #Trades From Table
    

    enter image description here

    根据查询计划,表插入占用的时间最多。

    enter image description here

    另外,估计的行数与实际行数不匹配。

    我是否可以改进用于创建临时表的查询的性能?

    PS:我尝试使用CREATETABLE创建一个临时表,并将查询更改为插入临时表,但没有多大帮助。

    0 回复  |  直到 7 年前
    推荐文章