Find statements with poor performance

1. Find statements with Low Efficiency Select   Top   10 Qs. total_worker_time, Qs. total_logical_reads, Qs. last_logical_writes, Qs. plan_handle,Qs.exe cution_count,( Select   Substring ( Text , Qs. statement_start_offset /

Index overwrite generation script

Set nocount onDeclare @ tbname varchar (30)Set @ tbname = 'user archives' Declare @ columns table (ID int, name varchar (30 )) Insert @ ColumnsSelect row_number () over (order by columns. object_id) ID,Columns. NameFrom SYS. ColumnsJoin SYS.

A major difference between Delete and truncate

    -- Create a test table Create Table test1 (id int)     Delete   Session 1   Begin tran Delete test1Insert test1Select 1   Session 2   Insert test1Select 1   First, second, second, and second completed instantly

Table value type generation

Declare @ tabletype varchar (max) =''Declare @ tablename varchar (max)Set @ tablename = 'student'Select @ tabletype = @ tabletype+ Case when types. Name in ('varchar ', 'nvarchar', 'Char ', 'nchar', 'varbinary ')Then' ['+ columns. Name +'] '+ ''+

Common commands of server cmd

TFTP-I 210.217.94.3 get gz.exe c: \ gz.exe Enable the remote computer to download ge.exeunder the directory 210.217.94.3to the cdisk ge.exe Ren c: \ ABC. asp *. exeUse the new name "abc.exe" to name "cdisk abc.asp" Net stop sharedaccessEnd

SQL tips = "time of the fifth and last Thursday of the week

1. Select dateadd (day, 6-datepart (weekday, getdate (), getdate () => this Friday Select dateadd (day,-datepart (weekday, getdate ()-2, getdate () => last Thursday 2. [SQL Server] reset the identity column and recount from 1 => DBCC Checkident (

Print all source code

Print all the source code (software companies, studios, individuals, do not need to purchase third-party printing controls to use them, you can also process and customize the print you need .) : Http://www.webmis.com.cn/DownLoad/MisGoldPrinter.rar

Database optimization collection

Source: Http://zhidao.baidu.com/question/1236568.html This article first discusses the basic design of database tables based on the third paradigm, and focuses on the strategies and solutions for establishing primary keys and indexes, then, the

Not an illusion

Drop table test1GoDrop table Test2GoCreate Table test1 (col1 int, col2 INT)GoCreate Table Test2 (col3 int, col4 INT)GoInsert into test1 values (1, 1)Insert into test1 values (2, 2)Insert into test1 values (3, 3)Insert into test1 values (4, 4)Insert

Stored Procedure execution

  Select object_name (object_id, database_id) stored procedure name,D. cached_time Compilation Time,D. last_execution_time the last execution time is Ms,D. total_elapsed_time/1000 total time spent in MS,D. total_elapsed_time/d.exe cution_count * 100

Index fragmentation, number of table rows, batch sorting script

Select objects. Name,Indexes. Name as indexid,Avg_fragmentation_in_percent as frag,Partition_stats.row_count,'Alter Index' + indexes. Name + 'on' + objects. Name + 'rebuild with (online = on )'From SYS. dm_db_index_physical_stats (7, null, 'limited')

Use DMV and DMF to analyze database performance

reason why the server is waiting select top 10 [Wait type] = wait_type, [wait time (s)] = wait_time_ms/1000, [% waiting] = convert (decimal (100.0), wait_time_ms * /sum (wait_time_ms) over () from sys. dm_ OS _wait_stats where wait_type not

Generate table creation statements

  Create procedure sp_get_table_info @ objname varchar (128)/* the table to generate SQL script */AsDeclare @ script varchar (255)Declare @ colname varchar (30)Declare @ colid tinyintDeclare @ usertype smallintDeclare @ typename sysnameDeclare @

Queries the physical hard disk size occupied by tables in the database.

Select   Object_name (I. Object_id ) As Tablename, data_pages * 8   As Datasize -- Here the number of data pages is returned, and 1 page is 8 K, So multiply by 8 From SYS. Indexes As I Join SYS. partitions

How to improve performance select Top N * from [tablename] order by newid ()

How to improve performance select Top N * from [tablename] order by newid () To obtain a random record from the databaseI checked this method online.However, tables with poor performance are more than 20 seconds old.How to improve

"The test form is only available for requests from the local machine" solution

I have just written about the service. The above problems will occur after deployment. I think many people may encounter similar problems. Let's solve them together! Cause: NET Framework 1.1 defines HttpPostLocalhost. By default, this new protocol

SQL 14-edit data

Data editing in the database is the most frequent task we have encountered. In this article, I will summarize the most commonly used data editing.    Select We often encounter a situation where we want to create a new table. The data in the table

Access Data Update problems!

In the standard expression, the data type does not match (Access). I remember this problem occurs when I first came into contact with asp.net. As a result, we encountered this problem again today and it took N hours to discover the problem (no

A problem encountered when using session (request solution)

Today, I made a test program to restore the original data when the changed data is stored in the database! This is my idea. 1. query button events In the query button event, data in the database is queried, stored in the able type (dt), and an

Restrictions on custom functions in Transact-SQL)

I always thought that the user-defined function only has a return value more than the stored procedure. I didn't think there were so many restrictions. The origin of the issue was caused by the following simple user-defined function:Create function

Total Pages: 64722 1 .... 54926 54927 54928 54929 54930 .... 64722 Go to: GO

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.