Update statistics false statistics

Source: Internet
Author: User
Tags rowcount

When we want to analyze the execution plan of some statements after a certain amount of data, it is possible to simulate the data and forge a large amount of data. However, this work is actually quite difficult. After a friend introduced me on the internet, I can see the following method of false statistics. It is very convenient to analyze the execution plan only.

Use tempdb

Go

Create Table T1 (I int, J INT)

Go

Create Table T2 (H int, k int)

Go

Set statistics profile on

Go

Select distinct (I) from T1

Go

Select * from T1, T2 where I = K order by J + k

Go

Update statistics T1 with rowcount = 10000, pagecount = 10000

Update statistics T2 with rowcount = 100000, pagecount = 100000

Go

Select distinct (I) from T1 option (recompile)

Go

Select * from T1, T2 where I = K order by J + k option (recompile)

If no recomplite is added to the SELECT statement, clear the cache: DBCC freeproccache.

From: http://blogs.msdn.com/ B /queryoptteam/archive/2006/07/21/674350.aspx

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.