I’m running an upgrade script against a database hosted in Microsoft SQL Server. It’s taking a while. Some of the queries are not worth optimising any further, for various reasons.
I’m the only person using this database: Is there a way that I can tell SQL Server to not bother with transactions/locking?
For instance, on a DELETE … WHERE, does SQL need to get exclusive locks on the rows it’s about to delete? If so, can I tell it not to bother, since this is the only running query?
See SQL Query Performance – Do you feel dirty? (Dirty Reads).
Edit: This is just speculation, but if you are the only connection to the SQL Server, you could get exclusive lock at the table level using
WITH (TABLOCKX). You are sacrificing concurrency, but it could get faster.