Why insert-select to variable table from XML variable so slow?

后端 未结 2 1331
难免孤独
难免孤独 2020-12-03 08:09

I\'m trying to insert some data from a XML document into a variable table. What blows my mind is that the same select-into (bulk) runs in no time while insert-select takes a

2条回答
  •  一向
    一向 (楼主)
    2020-12-03 09:09

    Looks to be an issue specific to SQL Server 2008. When I run the code in SQL Server 2005, both inserts run quickly and produce identical execution plans that start with the fragment shown below as Plan 1. In 2008, the first insert uses Plan 1 but the second insert produces Plan 2. The remainder of both plans beyond the fragment shown are identical.

    Plan 1

    alt text

    Plan 2

    alt text

提交回复
热议问题