transaction can be completed successfully. In general, it is a matter of undoing the small amount of modified data so that the rollback is less expensive. A database with row-level locks rarely has this problem because two users are less likely to modify the same record at the same time, and have fewer locks due to the very accidental order of data modification.Also, the database uses lock timeouts to avoid allowing users to wait too long. The introduction of query timeouts is also for the same
SQL Server logs and agent error days are usually automatically switched after the instance restarts, and if the instance has not been restarted for a long time, it may accumulate too many logs and is inconvenient to view.Log switchover: (Requires permission: Member of the sysadmin fixed server role)--"SQL
B First, and then locks table A, this may cause a deadlock. 5. Do not open large datasets 6. Do not use server-side cursors Compared to server-side cursors, client cursors can reduce server and network overhead and also reduce lockout time. 7. Do not ignore the problem of modifying the same record at the same time Som
Transferred from: http://www.cnblogs.com/zhijianliutang/p/4190669.html Conceptual understanding About statistics in SQL Server, as explained in Books Online Query optimization statistics are objects that contain statistics related to the distribution of values in one or more columns of a table or indexed view. The query optimizer uses these statistics to estimate the cardinality or number of rows in the qu
21 military rules developed by SQL Server
21 military rules developed by SQL Server
If you are in charge of a SQL Server-based project or you have just been in touch with SQL
raid 10 is created on four physical disks, the average value of the disk queue in a monitoring period is 10, the queue value of each disk is 10/4 = 2.5. Therefore, the disk array has an I/o bottleneck. This is the same as the previous disktime indicator. You don't have to worry about it occasionally. If it appears for a long time, you have to consider solving the disk I/O performance problem.
6. Processor: % Processor Time
This is an indicator for monitoring cpu usage (similar to disk time ). T
-consuming to index the above, so the efficiency is lower than using the self-increment field.3, CombGiven the pros and cons of the two primary key types above, the comb type can be used to find a balance for both. Its design idea is this: since the GUID type has no regularity can be made index inefficient, affecting the performance of the system, then can not be combined to preserve the GUID of the first 10 bytes, with the latter 6 bytes to represent the time of the GUID generation, so that the
consistency, and the whole database restoration process ends.-- {Use master-- Restore database Jacky Note: Database Jacky is composed of three files-- File = 'jack2'-- From jacky_datas-- With norecovery first restores the file group backup file jacky2 from the device jacky_datas to the database Jacky, but does not return the Database Consistency,-- Restore log Jacky-- From Jacky-- With file = 1, recovery} Then restores a backup file from the transaction log backup device Jacky to the database J
.
3. Section: Lock the entire section. Because a section is made up of 8 of pages, Block locking refers to locking the section, controlling the 8 data or index pages within that section, and all data rows in 8.
4. Page: Locks all data or index keys on the page.
5. Key: There is a lock on a specific key or series of keys in the index. Other keys in the same index page are not affected.
6. Row or row identifier (RID): Although technically the lock is placed on the row identifier (which is the
Quickly inserting Excel data from OLE DB into SQL Server, where many people stitch sql through loops, this is not only error-prone but inefficient, the best way is to use bcp, or System.Data.SqlClient.SqlBulkCopy class to implement. Not only is it fast, but the code is simple, the following test code imports a sheet of more than 60,000 data, including read (slow
, occasionally do not have to worry about, if a long time, then you have to start to consider solving the disk IO performance issues.6.Processor:% Processor timeThis is an indicator for monitoring CPU conditions (similar to disk Time). This is a key parameter for observing CPU utilization. If the value of the processor Time counter continues to exceed 80%, there is a bottleneck on the CPU. If it only happens occasionally, it may indicate that there is a particular CPU-consuming query at this poi
This article describes in detail how to optimize SQL Server database queries.
There are many reasons for slow query speed in SQL Server databases. The following are common causes:
1. No index or no index is used (this is the most common problem of slow query and is a defect in programming)
2. Low I/O throughput, res
There are many reasons for slow query speed in SQL Server databases. The following are common causes:
1. No index or no index is used (this is the most common problem of slow queryProgramDesign defects)
2. Low I/O throughput, resulting in a bottleneck effect.
3. the query is not optimized because no computing column is created.
4. Insufficient memory
5. slow network speed
6. The queried data vol
process are deadlocked on the lock resource and have been selected as the deadlock victim.
Here 's a demonstration of the situation.
To demonstrate two transaction deadlocks, we need to open two query windows in SQL Server Management Studio in the following tests. Ensure that transactions are not disturbed.
Demo aTransactions not committed, NOLOCK and READP
the sharing mode to the exclusive lock must wait for a while, because the exclusive lock of a transaction is incompatible with the Sharing Mode Lock of other transactions; a lock wait occurs. The second transaction attempts to obtain the row lock (x) for update. Because both transactions need to be converted to the (x) lock, and each transaction waits for another transaction to release the SQL Server datab
too high or there is a bottleneck in memory or disk.
Target Server Memory (KB), which is ideally capable of using the amount of RAM that is committed by the memory manager. If there is a difference between these two values, the memory exception is indicated.
General Statistics Statistics
User Connections;logins/sec;logouts/sec concurrency situation
Processes blocked current blocked quantity
Temp Tables for destru
Tags: work link query mds serve master replication keyword threadThe monitoring of database servers can be broadly divided into two categories: (1) Status monitoring: Is the database server running in a healthy way? (2) Performance monitoring: Healthy operation at the same time, there is no performance problems? Could it be quicker? a . Server 1. Status Monitoring (1) is the
Sys.dm_os_waiting_tasksFigure 3 The UPDATE statement (53) of session a above, blocking the SELECT statement for session B (52)We can also see the lock and block details for the entire database through the following two commands:SELECT * from sys.dm_tran_locksEXEC sp_lockFigure 4 Session ID = 52 process has been waiting for blocking (wait)Another kill command directly kills the process that caused the blockage, as follows:KILL 53-------------------------------------------------------------------
-------------------------------------------------------------------------------------------To solve the problem of waiting indefinitely, in addition to the aforementioned SET lock_timeout command, there is a more convenient approach, such as, in session B of the SQL statement, after the table name with the (NOLOCK) keyword, indicating that SQL Server is required,
SQL Server, which quickly inserts the Excel data read by OLE DB, is used by many people to stitch through the loops to make it both error-prone and inefficient, and the best way to do this is to use BCP, which is System.Data.SqlClient.SqlBulkCopy class to implement. Not only is it fast and the code is simple, the following test code imports a sheet of more than 60,000 data, including reads (slow to read all
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.