SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SQL 2008 Indexes


SQL 2008 Indexes

Author
Message
noeld
noeld
SSCrazy Eights
SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)

Group: General Forum Members
Points: 9566 Visits: 2048
Ninja's_RGR'us (2/3/2009)
I think I'd go with the instead of triggers... if it saves me a full clustered index rebuild.


True but like with every thing there is an "it depends" BigGrin

You will be kicking people out AFTER the "inserted" and "deleted" tables are created on tempdb. It "could" become a PIG!
In SQL 2000 inserted and deleted tables were built directly from the transaction log ... not any more Wink


* Noel
Ninja's_RGR'us
Ninja's_RGR'us
One Orange Chip
One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)

Group: General Forum Members
Points: 28861 Visits: 9671
Ah!, learn something new everyday Tongue.


That's a good it depends. There would need to have a buttload of traffic on that table to cause tempdb to crash or become a hotspot (unless it's already hot and getting worse because of that).



P.S. Just remember to deactivate the trigger before doing your big table load... that could really make a hot-spot of the server!
TomThomson
TomThomson
SSChampion
SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)

Group: General Forum Members
Points: 14302 Visits: 12197
noeld (2/3/2009)
Actually I have had the need for this feature for a long time.
Suppose you need to prevent changes on ONE table while you are doing some maintenance work in a Db.
To Set a DB in read-only mode is too drastic, To Setup that table in a separated File and make it read only is inconvenient.
To setup INSTEAD OF/AFTER TRIGGERS is expensive in Server resources.

This solution seems cheap and Fast Wink


It seems expensive to me, re-ednabling the clustered index implies rebuilding every index on the table. If the DB design is reasonable, there are a maybe a small number of roles which have permissions on this table - altering those permissions seems pretty cheap and easy (and also provides the option of making the table read only, which is a little less drastic than making it completely inaccessible - particularly if your objective is, as you suggest, just to prevent changes).

Tom

noeld
noeld
SSCrazy Eights
SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)

Group: General Forum Members
Points: 9566 Visits: 2048
Tom.Thomson (2/3/2009)
noeld (2/3/2009)
Actually I have had the need for this feature for a long time.
Suppose you need to prevent changes on ONE table while you are doing some maintenance work in a Db.
To Set a DB in read-only mode is too drastic, To Setup that table in a separated File and make it read only is inconvenient.
To setup INSTEAD OF/AFTER TRIGGERS is expensive in Server resources.

This solution seems cheap and Fast Wink


It seems expensive to me, re-ednabling the clustered index implies rebuilding every index on the table. If the DB design is reasonable, there are a maybe a small number of roles which have permissions on this table - altering those permissions seems pretty cheap and easy (and also provides the option of making the table read only, which is a little less drastic than making it completely inaccessible - particularly if your objective is, as you suggest, just to prevent changes).


That sounds nice when you control the code.


* Noel
noeld
noeld
SSCrazy Eights
SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)

Group: General Forum Members
Points: 9566 Visits: 2048
Oh And I have seen *MANY* people using simply db_datareader and db_datawriter.
You could take those permissions away and then the "entire" DB is inaccessible Sad


* Noel
Jeffrey Williams 3188
Jeffrey Williams 3188
SSCertifiable
SSCertifiable (7.7K reputation)SSCertifiable (7.7K reputation)SSCertifiable (7.7K reputation)SSCertifiable (7.7K reputation)SSCertifiable (7.7K reputation)SSCertifiable (7.7K reputation)SSCertifiable (7.7K reputation)SSCertifiable (7.7K reputation)

Group: General Forum Members
Points: 7693 Visits: 9967
Tom.Thomson (2/3/2009)
It seems expensive to me, re-ednabling the clustered index implies rebuilding every index on the table.


With SQL Server 2005 and greater, rebuilding the clustered index does not force a rebuild of all NC indexes.

Jeffrey Williams
Problems are opportunities brilliantly disguised as insurmountable obstacles.

How to post questions to get better answers faster
Managing Transaction Logs

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search