Preface#
This article is a record and reflection on the life from 2023-05-08
to 2023-05-14
.
Life#
- The new round of team check-in for not memorizing words has started, continue to memorize words.
- A colleague who is very capable and has been with the company for a long time has been optimized. It is now officially starting. Let's see how long I can last.
- This week's recipe
- Breakfast
-
Oatmeal yogurt cup
A layer of yogurt, a layer of oatmeal, make it in advance and seal it in the refrigerator overnight, and bring it to the company the next morning. It's convenient and delicious.
-
Bagel + cheese
Cut the bagel in half and freeze it in a sealed bag. Air fryer at 180 degrees for 5 minutes, spread cheese on it, and you can add a fried egg.
-
Pan-fried chicken cutlet + fried egg
Marinate the chicken thigh cutlet with Orleans seasoning in advance, wrap it in plastic wrap and put it in the refrigerator. Fry it with butter until the surface on both sides is cooked, then add water, cover the pot, and simmer for a few minutes.
-
- Breakfast
- Modify the global font setting of xLog
@import url("https://cdnjs.cloudflare.com/ajax/libs/lxgw-wenkai-screen-webfont/1.7.0/lxgwwenkaiscreenr.css"); :root { --font-family: "LXGW WenKai Screen R"; }
- Accidentally spilled powder on the grinding disc of the coffee grinder, and broke the adjustment lever when disassembling the grinding disc. It's frustrating...
Study#
English#
Difference between "Attend" and "Attempt"#
- "Attend" means "to take care of, look after" and also carries the meaning of "to be present". When expressing "trying" to complete something, it emphasizes the attitude of attention and effort towards the matter.
- "Attempt" means "to try, to attempt" and represents the action taken to achieve a goal or complete something. It emphasizes the actual action and effort taken.
- To summarize:
- "Attend" emphasizes the proactive attitude towards something.
- "Attempt" emphasizes the actual action and effort taken.
- "Attend" is more static, while "Attempt" is more dynamic.
- In some cases, the two can be interchangeable, but "Attend" focuses on mindset, while "Attempt" focuses on behavior.
"Hit the ground running"#
This is a fixed phrase that means "to start taking action immediately".
It means to quickly take action after entering a new environment (such as a new job position or project) without delay or postponement. It represents a proactive and quick-action mindset.
"Fall prey to sth"#
It usually describes a situation where one party is invaded, exploited, or influenced by a more powerful party due to being comparatively weak or inattentive.
"Wishful thinking"#
It refers to wishful or overly optimistic thinking, indicating an unrealistic or overly optimistic mindset.
"Multiplication table"#
The table that shows the results of multiplication.
"Stay put"#
It means to stay in the original position and not leave or move to another place. It indicates staying still or not taking action. It can be used to advise or inform someone to stay in their current position and not leave or go to another location temporarily.
This is often done for safety reasons, to prevent confusion, or while waiting for further instructions. It can also be used to indicate the inability to leave the current position due to various reasons such as work requirements.
Technology#
MySQL#
Index#
When there was a data issue that required modifying the database, selecting the data with a select
statement resulted in 36 rows, but using an update
statement with the same conditions affected over 1 million rows in the entire table. After contacting the DBA to add an index, the update
statement executed normally.
UPDATE `database`.`table` SET `column_a` = 'name' WHERE `column_b` = 'message' AND `column_a` = 'default'
-- Add index
-- idx_a_b `column_a`, `column_b` NORMAL BTREE
Reason
https://xiaolincoding.com/mysql/lock/update_index.html
The default transaction isolation level of the InnoDB storage engine is "Repeatable Read". However, under this isolation level, when multiple transactions are concurrent, phantom reads may occur. Phantom reads refer to the phenomenon that when the same query is executed twice in the same transaction, the second query may return rows that did not exist before.
Therefore, the InnoDB storage engine implements row-level locks itself, using next-key locks (a combination of record locks and gap locks) to lock the records themselves and the "gaps" between records, preventing other transactions from inserting new records between these records, thus avoiding the phenomenon of phantom reads.
When we execute an update
statement, it actually acquires an exclusive lock (X lock) on the records. If another transaction tries to modify the records held by the exclusive lock, it will be blocked. Additionally, this lock is not released immediately after the update
statement is executed, but is released when the transaction ends.
If the
where
condition of theupdate
statement does not use an index, it will perform a full table scan, resulting in next-key locks (record locks + gap locks) being acquired on all records.
Summary
An update
statement must meet one of the following conditions to be executed successfully:
- Use
where
and thewhere
condition must involve indexed columns. - Use
limit
. - Use both
where
andlimit
, in which case thewhere
condition can involve non-indexed columns.
A delete
statement must meet one of the following conditions to be executed successfully:
- Use
where
and thewhere
condition must involve indexed columns. - Use both
where
andlimit
, in which case thewhere
condition can involve non-indexed columns.
If the where
condition includes indexed columns, but the optimizer chooses to perform a full table scan instead of using the index, we can use force index([index_name])
to tell the optimizer which index to use, thereby avoiding the potential risk of locking the entire table.
Favorites#
- tldr Simplified and community-driven man pages.
- Vim Adventures A game to learn how to use Vim online.