disc_content表是海量数据,content_temp1是生成的表,
下列SQL语句还有提升速度和性能的空间吗?应该怎么写就能提升速度?CREATE procedure form_content_temp1
asif object_id('content_temp1') is not null drop table content_temp1
         select disc_content_id,contentstructure,correspondingdiscid 
         into content_temp1 
         from disc_content order by contentstructure asc , correspondingdiscid asc
GO

解决方案 »

  1.   

    1:如果使用你的方法的话,如果不要日志的话,使用truncate关键字而不是drop
    2:大数据量的插入,建议使用增量式的数据更新方式
      

  2.   

    http://www.cnblogs.com/worfdream/articles/3046377.html
    http://www.cnblogs.com/worfdream/articles/3046377.html
      

  3.   

    如果不看into content_temp1代码的话,你后面没有任何条件,等于是全表扫描。
    要么你将contentstructure asc , correspondingdiscid asc这两个字段创建复合索引,并且指定按照asc排序。
    另外,考虑到对系统表的影响,还是先创建content_temp1表,然后在insert比较好。