Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. OPENXML() and performance

OPENXML() and performance

Scheduled Pinned Locked Moved Database
performancehelpsharepointdatabasexml
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kjetil Svendsen
    wrote on last edited by
    #1

    Hi. I have a stored procedure, and it's working fine. One of the input parameters is XML (@p_xml) and is processed like this:

    DECLARE @docHandle int
    EXEC sp_xml_preparedocument @docHandle OUTPUT, @p_xml

    SELECT * INTO #raw_table
    FROM
    OPENXML(@docHandle, '//NODE', 2)

    The problem is when the XML is really big (~20 MB with ~35000 nodes). Then the OPENXML statement uses 7-8 minutes to finish. Is there any way to speed up OPENXML, or is there any other workaround ? I have tried both select into and insert into and both temp table and table variable. All with the same result. Could someone help me ? Kjetil

    A 1 Reply Last reply
    0
    • K Kjetil Svendsen

      Hi. I have a stored procedure, and it's working fine. One of the input parameters is XML (@p_xml) and is processed like this:

      DECLARE @docHandle int
      EXEC sp_xml_preparedocument @docHandle OUTPUT, @p_xml

      SELECT * INTO #raw_table
      FROM
      OPENXML(@docHandle, '//NODE', 2)

      The problem is when the XML is really big (~20 MB with ~35000 nodes). Then the OPENXML statement uses 7-8 minutes to finish. Is there any way to speed up OPENXML, or is there any other workaround ? I have tried both select into and insert into and both temp table and table variable. All with the same result. Could someone help me ? Kjetil

      A Offline
      A Offline
      Ashfield
      wrote on last edited by
      #2

      I doubt it. Its not the fast thing around. BTW, with the code shown, you do realise you are locking most of the system tables in your tempdb database for the 7-8 minutes it takes to run. A select into locks system tables for the duration of its run, this could seriously impact other users. Sorry I can't help further.

      Bob Ashfield Consultants Ltd

      K 1 Reply Last reply
      0
      • A Ashfield

        I doubt it. Its not the fast thing around. BTW, with the code shown, you do realise you are locking most of the system tables in your tempdb database for the 7-8 minutes it takes to run. A select into locks system tables for the duration of its run, this could seriously impact other users. Sorry I can't help further.

        Bob Ashfield Consultants Ltd

        K Offline
        K Offline
        Kjetil Svendsen
        wrote on last edited by
        #3

        Hi. I actually use insert into, but I was to lazy to paste the table declaration in my post :) Kjetil

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups