As a social App, we have many operations at the same time. To ensure data consistency, we will use database things.For example, now we have a thumbs up operation. After the thumbs up operation is successful, we need to change the popularity of the
MySQL deadlock problem is a lot of programmers in the development of the project often encountered problems, the MySQL deadlock and the solution is as follows:
1, MySQL common storage engine lock mechanism
MyISAM and memory using table-level locks
MySQL indexing function
On the index column, in addition to the ordered lookup, the database can greatly improve the query efficiency by using a variety of fast positioning techniques. In particular, when the volume of data is very large and
MySQL Deadlock case analysis and solutionsPhenomenon:Database query:SQL Statement Analysis:Mysql. Concurrent Delete same row record, occasional deadlock. Delete from x_table where id=? Deadlock Analysis:MySQL's transactional support is related to
Directory
Introduction to the Index
The role of the index
What kinds of common indexes are there?
Normal index
Unique index
Primary key Index
Combined index
Index nouns
Leftmost prefix
Considerations for
Previous wordsIndexes can often greatly improve the efficiency of queries, and if there is no index, MongoDB must scan every file in the collection and select those records that meet the query criteria when reading the data. This scan full set of
Naming rules: Table name _ Field name1. Fields that need to be indexed, in the Where condition2. Fields with low data need not be indexed3, if the Where condition is an OR relationship, index does not work4, accord with the left
Worked for a year and was the first to use the MySQL index. I was amazed by the increase in speed after the index was added. The old staff next door saw my fuss and made a plain return to the phrase, "that's for sure."For any DBMS, the index is the
One, the index in MySQL:We have seen the index in the array, and the advantage is that it can be quickly detected by subscript or index;The ability to quickly locate a message;What is the index in 1.MySQL?It is the field that has the index in our
Index functionIn addition to the ordered lookups mentioned above, the database uses a variety of fast location techniques to greatly improve the query efficiency. In particular, when the amount of data is very large and the query involves more than
Index typeMONGDB indexes are divided into the following types: Single-key index, composite index, geospatial Index, full-text index, and hash indexSingle-key index (single Field Indexes)An index created on a key is a single-key index, which is the
1 Various tree-shaped structuresOriginally not intended to start from the two-fork search tree, because there are too many related articles on the Internet, but considering the clear diagram of the understanding of the problem is very helpful, but
Problem descriptionIn the process of doing the project, because write SQL too arbitrary, accidentally threw a deadlock exception, as follows:[Java]View Plaincopyprint?
Com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException:Deadlock
In computer science, a lock is a synchronization mechanism used to forcibly restrict access to resources when executing multiple threads, which is used to guarantee the satisfaction of mutex requirements in concurrency control.In the DBMS,
Naming rules: Table name _ Field name1. Fields that need to be indexed, in the Where condition2. Fields with low data need not be indexed3, if the Where condition is an OR relationship, index does not work4, accord with the left
1. The lock mechanism of MySQL common storage engineMyISAM and memory with table-level lock (Table-level locking)BDB with page lock (page-level locking) or table-level lock, default to page lockInnoDB supports row-level locks (row-level locking) and
SummaryThis article describes MySQL's InnoDB index-related knowledge, from a variety of tree-to-index principles to the details of storage.InnoDB is the default storage engine for MySQL (Mysql5.5.5 before MyISAM, documentation). In the purpose of
1, MyISAM uses B+tree as the index structure, the leaf node data holds the pointer, namely the record address. The primary key index and the secondary index are the same.2, InnoDB also use B+tree as the index structure, also do not need to note that
Summary:This article describes MySQL's InnoDB index-related knowledge, from a variety of tree-to-index principles to the details of storage.InnoDB is the default storage engine for MySQL (Mysql5.5.5 before MyISAM, documentation). In the purpose of
This article mainly introduces how to view, create, and delete indexes in MySQL, and analyzes the functions of indexes in MySQL in detail based on the instance form, you can also learn how to view, create, and delete indexes. you can refer to the
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.