• msandico 57892 (8/30/2012)


    we never REBUILD because of the requirement of the system to stay UP all the time

    REBUILD supports the ONLINE option. I presume you have Enterprise Edition and are using the ONLINE option already when adding indexes.

    we REORGANIZE weekly but on a heap table, i believe the non-clustered indexes will still be fragmented

    ALTER INDEX ... REORGANIZE allows you to specify ALL indexes or individual ones. Both ALTER INDEX ALL and ALTER TABLE REBUILD affect the heap and all non-clustered indexes, as far as I recall.

    I also thought about giving a row locking hint (PAGLOCK) not (TABLOCK), because in the graph isn't it trying to lock the table to do the changes? My theory is that if the INSERT and UPDATE does a PAGLOCK then maybe a deadlock won't occur because the processes are locking at the page level rather than the table level..thus reducing the chance of wanting each other's resources...does that even make sense?

    That's the broad theory of it, yes.

    I barely have access to the code as the app that's sending the queries is developed by a third-party..but i have rare access to them if absolutley needed..just wondering if this can be fixed at the server side before going to client side..

    Not that I know of. We can't use a plan guide to specify a lock-granularity hint for the table using the TABLE HINT syntax because it affects the semantic of the query (you get error 8722 if you try this).