SQL Server enforces the use of specific indexes, degrees of parallelism

Source: Internet
Author: User

SQL Server enforces the use of specific indexes, degrees of parallelism

Back up before modifying or deleting data, back up first, back up (important things say three times)

Most of the time you may want to test, perhaps in order to avoid the concurrency to your SQL problems, often need to force the specified target SQL to select an index or degree of parallelism to execute, today to share the SQL enforcement behavior 11

1. Force the use of an index

Select Id,name from A where id=2 with INDEX (idx_name)

2. Enforce the use of a degree of parallelism

Select Id,name from A where id=2 with option (maxdop=1)

3, Force without lock

Select Id,name from A with (NOLOCK)

4. Forced hold lock

Select Id,name from A with (Holdlock)

Above, in some special scenarios may be able to help you!

SQL Server enforces the use of specific indexes, degrees of parallelism

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.