Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8851

select with reformat causing blocking in tempdb

$
0
0

We're running a single select from temp tables and non-temp tables and its causing blocking on tempdb..sysobjects

 

The from clause has 3 temp tables and 5 non-temp tables in it.

 

The optimiser is creating a work table with a clustered index and we're seeing blocking on sysobjects in tempdb for the duration of the whole SQL.

 

I thought this issue of blocking sysobjects had been fixed?!!?

 

Here's the results of the showplan and sp_lock.

Anyone explain what's happening ?

 

 

sp_lock shows

 

fid    spid   loid     locktype       table_id    page        row    dbname        class             context         

------ ------ -------- -------------- ----------- ----------- ------ ------------- ----------------- ---------

      0    381      762 Sh_intent        260312833           0      0 CPGdb         Non Cursor Lock             

      0    381      762 Sh_intent        494012891           0      0 CPGdb         Non Cursor Lock              

      0    381      762 Sh_page          494012891     7502962      0 CPGdb         Non Cursor Lock   Ind pg

      0    381      762 Sh_intent        140527534           0      0 cds2db        Non Cursor Lock 

      0    381      762 Sh_page          140527534        4549      0 cds2db        Non Cursor Lock  

      0    381      762 Sh_intent       1116531011           0      0 cds2db        Non Cursor Lock  

      0    381      762 Sh_intent       1929057908           0      0 cds2db        Non Cursor Lock  

      0    381      762 Sh_intent                1           0      0 tempdb        Non Cursor Lock   

      0    381      762 Sh_row-blk               1           5      8 tempdb        Non Cursor Lock   Range

      0    381      762 Sh_intent               28           0      0 tempdb        Non Cursor Lock

      0    381      762 Sh_row                  28          84      3 tempdb        Non Cursor Lock   Range

      0    381      762 Ex_table        1158865492           0      0 tempdb        Non Cursor Lock                    

      0    381      762 Ex_table        1174865549           0      0 tempdb        Non Cursor Lock   

      0    381      762 Ex_table        1366866233           0      0 tempdb        Non Cursor Lock  

 

 

QUERY PLAN FOR STATEMENT 1 (at line 2).

Optimized using Serial Mode

Optimized using the forced options (internally generated Abstract Plan).

 

    STEP 1

        The type of query is SELECT.

 

 

        17 operator(s) under root

 

 

       |ROOT:EMIT Operator (VA = 17)

       |

       |   |RESTRICT Operator (VA = 16)(0)(0)(0)(0)(12)

       |   |

       |   |   |SEQUENCER Operator (VA = 15) has 2 children.

       |   |   |

       |   |   |   |STORE Operator (VA = 2)

       |   |   |   |  Worktable1 created, in allpages locking mode, for REFORMATTING.

       |   |   |   |  Creating clustered index.

       |   |   |   |

       |   |   |   |   |INSERT Operator (VA = 1)

       |   |   |   |   |  The update mode is direct.

       |   |   |   |   |

       |   |   |   |   |   |SCAN Operator (VA = 0)

       |   |   |   |   |   |  FROM TABLE

       |   |   |   |   |   |  DB1..A

       |   |   |   |   |   |  a

       |   |   |   |   |   |  Using Clustered Index.

       |   |   |   |   |   |  Index : idx1

       |   |   |   |   |   |  Forward Scan.

       |   |   |   |   |   |  Positioning by key.

       |   |   |   |   |   |  Keys are:

       |   |   |   |   |   |    at ASC

       |   |   |   |   |   |  Using I/O Size 16 Kbytes for index leaf pages.

       |   |   |   |   |   |  With LRU Buffer Replacement Strategy for index leaf pages.

       |   |   |   |   |   |  Using I/O Size 16 Kbytes for data pages.

       |   |   |   |   |   |  With LRU Buffer Replacement Strategy for data pages.

       |   |   |   |   |

       |   |   |   |   |  TO TABLE

       |   |   |   |   |  Worktable1.

       |   |   |

       |   |   |   |N-ARY NESTED LOOP JOIN Operator (VA = 14) has 3 children.

       |   |   |   |

       |   |   |   |   |NESTED LOOP JOIN Operator (VA = 11) (Join Type: Left Outer Join)

       |   |   |   |   |

       |   |   |   |   |   |N-ARY NESTED LOOP JOIN Operator (VA = 9) has 5 children.

       |   |   |   |   |   |

       |   |   |   |   |   |   |SCAN Operator (VA = 3)

       |   |   |   |   |   |   |  FROM TABLE

       |   |   |   |   |   |   |  #al

       |   |   |   |   |   |   |  l

       |   |   |   |   |   |   |  Table Scan.

       |   |   |   |   |   |   |  Forward Scan.

       |   |   |   |   |   |   |  Positioning at start of table.

       |   |   |   |   |   |   |  Using I/O Size 16 Kbytes for data pages.

       |   |   |   |   |   |   |  With LRU Buffer Replacement Strategy for data pages.

       |   |   |   |   |   |

       |   |   |   |   |   |   |SCAN Operator (VA = 4)

       |   |   |   |   |   |   |  FROM TABLE

       |   |   |   |   |   |   |  #pl

       |   |   |   |   |   |   |  pl

       |   |   |   |   |   |   |  Table Scan.

       |   |   |   |   |   |   |  Forward Scan.

       |   |   |   |   |   |   |  Positioning at start of table.

       |   |   |   |   |   |   |  Using I/O Size 2 Kbytes for data pages.

       |   |   |   |   |   |   |  With LRU Buffer Replacement Strategy for data pages.

       |   |   |   |   |   |

       |   |   |   |   |   |   |RESTRICT Operator (VA = 6)(0)(0)(0)(0)(13)

       |   |   |   |   |   |   |

       |   |   |   |   |   |   |   |SCAN Operator (VA = 5)

       |   |   |   |   |   |   |   |  FROM TABLE

       |   |   |   |   |   |   |   |  #ps

       |   |   |   |   |   |   |   |  ps

       |   |   |   |   |   |   |   |  Index : idx3

       |   |   |   |   |   |   |   |  Forward Scan.

       |   |   |   |   |   |   |   |  Positioning by key.

       |   |   |   |   |   |   |   |  Keys are:

       |   |   |   |   |   |   |   |    i ASC

       |   |   |   |   |   |   |   |  Using I/O Size 2 Kbytes for index leaf pages.

       |   |   |   |   |   |   |   |  With LRU Buffer Replacement Strategy for index leaf pages.

       |   |   |   |   |   |   |   |  Using I/O Size 2 Kbytes for data pages.

       |   |   |   |   |   |   |   |  With LRU Buffer Replacement Strategy for data pages.

       |   |   |   |   |   |

       |   |   |   |   |   |   |SCAN Operator (VA = 7)

       |   |   |   |   |   |   |  FROM TABLE

       |   |   |   |   |   |   |  DB2..u

       |   |   |   |   |   |   |  u

       |   |   |   |   |   |   |  Table Scan.

       |   |   |   |   |   |   |  Forward Scan.

       |   |   |   |   |   |   |  Positioning at start of table.

       |   |   |   |   |   |   |  Using I/O Size 16 Kbytes for data pages.

       |   |   |   |   |   |   |  With LRU Buffer Replacement Strategy for data pages.

       |   |   |   |   |   |

       |   |   |   |   |   |   |SCAN Operator (VA = 8)

       |   |   |   |   |   |   |  FROM TABLE

       |   |   |   |   |   |   |  DB1..w

       |   |   |   |   |   |   |  w

       |   |   |   |   |   |   |  Using Clustered Index.

       |   |   |   |   |   |   |  Index : wd_pk

       |   |   |   |   |   |   |  Forward Scan.

       |   |   |   |   |   |   |  Positioning by key.

       |   |   |   |   |   |   |  Keys are:

       |   |   |   |   |   |   |    c ASC

       |   |   |   |   |   |   |    d ASC

       |   |   |   |   |   |   |  Using I/O Size 16 Kbytes for data pages.

       |   |   |   |   |   |   |  With LRU Buffer Replacement Strategy for data pages.

       |   |   |   |   |

       |   |   |   |   |   |SCAN Operator (VA = 10)

       |   |   |   |   |   |  FROM TABLE

       |   |   |   |   |   |  DB2..c

       |   |   |   |   |   |  c

       |   |   |   |   |   |  Using Clustered Index.

       |   |   |   |   |   |  Index : idx1

       |   |   |   |   |   |  Forward Scan.

       |   |   |   |   |   |  Positioning by key.

       |   |   |   |   |   |  Keys are:

       |   |   |   |   |   |    cid ASC

       |   |   |   |   |   |    d ASC

       |   |   |   |   |   |    s ASC

       |   |   |   |   |   |  Using I/O Size 2 Kbytes for data pages.

       |   |   |   |   |   |  With LRU Buffer Replacement Strategy for data pages.

       |   |   |   |

       |   |   |   |   |SCAN Operator (VA = 12)

       |   |   |   |   |  FROM TABLE

       |   |   |   |   |  DB2..cd

       |   |   |   |   |  cd

       |   |   |   |   |  Index : idx1

       |   |   |   |   |  Forward Scan.

       |   |   |   |   |  Positioning by key.

       |   |   |   |   |  Keys are:

       |   |   |   |   |    cid ASC

       |   |   |   |   |  Using I/O Size 2 Kbytes for index leaf pages.

       |   |   |   |   |  With LRU Buffer Replacement Strategy for index leaf pages.

       |   |   |   |   |  Using I/O Size 2 Kbytes for data pages.

       |   |   |   |   |  With LRU Buffer Replacement Strategy for data pages.

       |   |   |   |

       |   |   |   |   |SCAN Operator (VA = 13)

       |   |   |   |   |  FROM TABLE

       |   |   |   |   |  Worktable1.

       |   |   |   |   |  Using Clustered Index.

       |   |   |   |   |  Forward Scan.

       |   |   |   |   |  Positioning by key.

       |   |   |   |   |  Using I/O Size 2 Kbytes for data pages.

       |   |   |   |   |  With LRU Buffer Replacement Strategy for data pages.

 

Total estimated I/O cost for statement 1 (at line 2): 2147483647.


Viewing all articles
Browse latest Browse all 8851

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>