Characteristics of a transactionAtomicity: Either all executes, or none of them executes.Consistency: When a transaction completes, all data remains in a consistent state.Isolation: A concurrent transaction either modifies the state before another
Original: Lock in SQL Server insert operationThis blog post briefly describes the locks used in an INSERT statement in SQL Server.Preparing DataFirst we create a table table_1, which has two column IDs (bigint) and value (varchar), where the ID
Today to see a Bo Friends of the article, feel good, reprint, hope to help you, more articles, please visit: http://blog.haoitsoft.com1, no index or no index (this is the most common problem of slow query, is the defect of program design)2, I/O
MS SQL Server Query optimization methodThe reasons for the slow query are many, the following are common1, no index or no index (this is the most common problem of slow query, is the defect of program design)2, I/O throughput is small, forming a
There are a number of reasons why queries are slow, often as follows:
1, no index or no index (this is the most common problem of query slow, is the defect of program design)
2, I/O throughput is small, creating a bottleneck effect.
3. No computed
1. SQL transaction
Benefits: Best Execution efficiency
Restrictions: Transaction contexts are invoked only in the database, and complex business logic is difficult to implement.
[SQL] View Plain copy print? create procedure tran1 as
Problem Description:
A basic information table, with more than 30 tables in the system, there is a foreign key relationship, when the basic data to delete, you need to determine whether has been used, if used to change the flag bit, if not used to
I/O throughput is small, creating a bottleneck effect.A computed column was not created to cause the query to be not optimized.There is not enough memory.Network speed is slow.The amount of data queried is too large (you can use multiple queries and
To find the oldest active transaction, you can use the DBCC OPENTRAN command. See Msdn:http://msdn.microsoft.com/zh-cn/library/ms182792.aspx for detailed usage
Give an example:
Copy Code code as follows:
CREATE TABLE t_product (pkid
Introducing Tsqlunit
Tsqlunit Introduction
Tsqlunit is a open source unit testing Framework for T-SQL written by Henrik Ekelund and available from http://sourceforg E.net/projects/tsqlunit. Here's a example of how I ' ve used it.
My tsqlunit tests
Often see the problem of deadlock, generally is the kill process, but if you do not detect the cause of the deadlock, deadlock will often occur
Can be found by the operation of the deadlock, you can easily resolve the deadlock, is the day-to-day
Reference: Introduction to SQL Transaction (Transaction) usage and rollback instance
--Test table
CREATE TABLE T1
(
ID int identity (1,1),
Code nvarchar) go
--Stored procedure
Create Procedure P_rollbacktest
as
begin
SET NOCOUNT
asp.net| data
Many database operations need to be transacted, and there are roughly 3 levels of transactions under ASP.net:
(1) Transaction at the level of the stored procedure
(2) Ado.net-level transactions
(3) asp.net transaction at the page level
If two threads modify the same record in the database at the same time, it causes the latter record to overwrite the previous one, causing some problems.For example:A ticketing system has a number of votes, the client every call to the ticket method,
• Trigger (Trigger)"Trigger is essentially a stored procedure, but not an EXE to invoke execution, but to change the operation of the database by adding and deleting""Trigger only for increase, deletion, change effective"Format of the trigger(The
Isolation levels in SQL Server control the locking works between transactions.SQL Server supports the following isolation levels
Read UNCOMMITTED
Read Committed (the default)
Repeatable Read
Serializable
Snapshot
Before
The source of this article: http://www.cnblogs.com/wy123/p/6189100.htmlThe title is a bit awkward,First throw the question: A query does not explicitly specify the ordering method, then, the second time the same query execution, the query results
1, no index or no index (this is the most common problem of slow query, is the defect of program design)2, I/O throughput is small, forming a bottleneck effect.3. No computed columns are created, resulting in queries not being optimized.4.
If you have to be careful when you want to perform data churn in production, you can use transactions to verify in advance whether your own SQL is what you expect. Especially if there is a problem with the where condition of the update, the new
1, no index or no index (this is the most common problem of slow query, is the defect of program design)2, I/O throughput is small, forming a bottleneck effect.3. No computed columns are created, resulting in queries not being optimized.4.
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.