This article mainly introduces the MySQL replace into the sentence analysis (ii), this article focuses on a number of special case analysis, the need for friends can refer to the
An introduction
The basic principle of replace into is introduced in the previous article. This chapter provides an example of the potential data quality risk associated with the replace into, and when a table involving a replace into operation contains a self-added primary key, the primary switch causes inconsistenci
MYSQL demonstrates the isolation level of the relational database. the concurrent access to the relational database has the following problems:
Dirty read: For two things T1 and T2, T1 reads fields that have been updated by T2 .. If T2 is rolled back, the content read by T1 is temporary and invalid.
Non-repeated read: T1
It took a long time to see a friend importing data! There are actually a lot of quick methods to work out! There are many ways to insert data into a table, but the performance varies with different methods.
It took a long time to see a friend importing data! There are actually a lot of quick methods to work out! There are many ways to insert data into a table, but the performance varies with different methods.
It took a long time to see a friend importing data! There are actually a lot of q
thread ends due to an exception, a new thread will replace it. This thread pool ensures that all tasks are executed in the order they are submitted.
Test Case:
We create a Text thread for testing:
class Text implements Runnable{ String name; public Text(String name){ this.name = name; } @Override public void run() { System.out.println(Thread.currentThread().getName() + "--" + name); } }
Now let's test the effect of the threa
operation.
Because of the implementation relationship of the preceding business scenario, the database operations in an abstracted transaction are as follows:
Start transaction; // Start a transaction
Delete from 'order' where mermer_id = XXX; // Delete all orders under XXX
Insert into 'order' (mermer_id) values (xxx); // Inset multiple orders under XXX
Insert into 'order' (mermer_id) values (xxx );
Insert into 'order' (mermer_id) values (xxx );
..........
Commit; // transaction Commit
In the
1. Calculate the total score and rank each person Select name, sum (score) as allscore from stuscore group by name order by allscore2. Calculate the total score and rank each person Select distinct t1.name, t1.stuid, t2.allscore from stuscore t1, (select stuid, sum (score) as allscore from stuscore group by stuid) t2where t1
-----------------------------------------------------------------------------------------------------------
Gather Motion (slice1; segments: 1) (cost = 0. 00 .. 1.01 rows = 1 width = 6)
Rows out: 1 rows at destination with 2.032 ms to first row, 2.033 ms to end, start offset by 0.500 ms.
-> Seq Scan on gtt1 (cost = 0. 00 .. 1.01 rows = 1 width = 6)
Filter: id = 11 AND name: text = 'B': text
Rows out: 1 rows with 0.062 ms to first row, 0.065 ms to end, start offset by 328 ms.
Slice statistics:
(
1. Calculate the total score and rank each person
Select name, sum (score) as allscore from stuscore group by name order by allscore
2. Calculate the total score and rank each person
Select distinct t1.name, t1.stuid, t2.allscore from stuscore T1, (select stuid, sum (score) as allscore from stuscore group by stuid) t2where
= db3, old shema = db3, borrowed = true, fromSlaveDB = false, threadId = 52, charset = latin1, txIsolation = 3, autocommit = true, attachment = null, respHandler = null, host = 13.217.1.11, port = 3317, statusSync = null, writeQueue = 0, modifiedSQLExecuted = false]
5. Execute a simple query. If the shard field ID field is specified, query a single shard node through the shard.
Result of mycat command:
mysql> explain select * from ORDER0401 t1 wher
contains another # include file, it will also follow up and process each header file in order, so recursive ..)
3. Internal and external links:Internal and external links are relatively basic, but they are also the easiest and most common mistakes for new users. Therefore, we need to discuss them in detail here.Is the internal link generated only locally ?. OBJ, and the external link symbol is visible between all *. obj.For example, if inline is used, the variables directly declared in the file
View execution plans that have executed SQL
First, grab one of the most IO-consuming SQL in the last hour.
SELECT sql_id, COUNT (*)
from Gv$active_session_history Ash, gv$event_name evt
WHERE ash.sample_time > SYSDATE-1/24 and
ash.session_state = ' waiting ' and
ash.event_id = evt.event_id and
evt.wait_class = ' User i/ O '
GROUP by sql_id ORDER by
COUNT (*) DESC;
View SQL Execution Plan
SELECT * from TABLE (dbms_xplan.display_cursor (' 51f3uqkpv1fja '));
sql_id 51f3uqkpv1fja, child number
1. Calculate each person's total score and rank
Select Name,sum (Score) as Allscore from Stuscore Group by name ORDER by Allscore
2. Calculate each person's total score and rank
Select DISTINCT T1.name,t1.stuid,t2.allscore from Stuscore T1, (select Stuid,sum (Score) as Allscore to Stuscore Group by STUID) T2where T1
1, creating table: Create ' t1 ', ' F1 ', ' F2 ', ' F3 ' #-------T1 is the table name, F1,F2 , F3 is the column family name 2, view all tables: list3, view the structure of the table: describe ' t1 ' 4, add a column family: Disable ' T1 ' nbsp alter ' T1
to ensure acid performance, but this will be relatively low and the database system can be said to be basically unusable. Therefore, in order to improve concurrency, we need to reduce the requirement of isolation. Depending on your business needs, we need to trade off between the concurrency and isolation levels, and a common DBMS will typically provide multiple isolation levels for users to choose from.Ii. Abnormal Phenomena 2.1 dirty write (Dirty Write)There are two transactions
Delete multiple table data in MySQLDelete deletes multiple table data, how can you delete data from multiple associated tables at the same time? Here's an in-depth explanation:1. Delete from T1 where condition2. Delete t1 from T1 where condition3. Delete T1 from T1,t2 where
From the very beginning, when I got started with js, I felt flexible. Everyone's writing methods were different. For example, a function has N types of writing: 1. function
From the very beginning, when I got started with JavaScript, I felt flexible. Everyone's writing methods were different. For example, a function had N writing methods.
For example: function showMsg () {}, var showMsg = function () {}, showMsg = function (){}
There seems to be no difference. They are all the same. Is it true?
){document.write(s+"");}Function
From the very beginning, when I got started with JavaScript, I felt flexible. Everyone's writing methods were different. For example, a function had N writing methods, such:
function showMsg(){}var showMsg = function(){}showMsg = function(){}
There seems to be no difference. They are all the same. Is it true? Let's take a look at the example below:
/// Functions // function Definition: Name function (declarative), anonymous function (referenced) // declarative
In the following example, a class test is defined, and the # Include # Include Using namespace STD;
Class test {Public:Int V;/* Constructor */Test (): V (0 ){}Test (const Int A): V (){}Test (const Test T1): V (t1.v ){}/* The following heavy loads are less than signs // Compare the sizes of two objectsBool operator Return (v }// Compare the object and INT sizeBool operator Return (v }// Compare the int an
Other properties or methods of the thread objectmethods for thread instance objects # isAlive (): Returns whether the thread is active. # getName (): Returns the thread name. # setName (): Sets the thread name. Some of the methods provided by the threading module are:# threading.currentthread (): Returns the current thread variable. # threading.enumerate (): Returns a list that contains the running thread. Running refers to threads that do not include pre-and post-termination thread
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.