MySQL performance optimization

Table design optimization SQL optimization system→ const→ eq_ref→ ref→ range→ index→ ALL. The goal of SQL performance optimization should at least reach rangelevel 1, and ideally it ref should be level consts 2. The main optimization method is indexes , which will be discussed in detail in the “Index Optimization” section later. question Disadvantages of Large SQL Advantages of splitting into smaller SQL statements Lock contention … Read more

Data Structure: Tree

Definition A tree is a non-linear data structure consisting of a finite set of n (n≥0) nodes: Key terms the term definition Root node The topmost node of a tree, with no parent node (like the “root directory” of a file system). Parent node/child node If node A directly contains node B, then A is the parent … Read more

Preliminary understanding of STL and string

What is STL? STL (Standard Template Library): It is an important part of the C++ standard library. It is not only a reusable component library, but also a software framework that encompasses data structures and algorithms. STL version updates The original version, completed by Alexander Stepanov and Meng Lee at HP Labs, adhered to the … Read more

Slow queries in MySQL (slow log)

1. What is a slow query? The slow query log is a log of queries that take a significant amount of time to execute. It records all long_query_timeSQL statements that exceed a time threshold set by parameters, helping developers analyze and optimize database query performance. By default, 慢查询日志the slow query log is disabled; it must be enabled … Read more

MySQL-TRIGGER

1. What is a trigger? 2. Advantages and disadvantages of triggers The advantages of triggers are as follows: The disadvantages of triggers are as follows: 3. Types of triggers NEW and OLD type triggers: NEW indicates data that will be added or has already been added; OLD type triggers indicate data before modification, NEW indicates … Read more

Delayed loading and L2 caching in mybatis

I. Lazy Loading 1. Core Definition Lazy loading is MyBatis’s optimization mechanism for related queries : when querying the main object, its related objects (such as the one-to-many relationship between users and accounts) are not queried immediately. The SQL execution of the related query is only triggered when the related object is actually used (getter method is called). 2. Core … Read more

Detailed Explanation of Lua Data Structures

This tutorial provides a detailed introduction to data structures in Lua, with a focus on Lua’s unique data structure—Tables—and its various uses. 1. Tables – The only data structure in Lua Tables in Lua are a powerful data structure that can be used to represent various data formats such as arrays, dictionaries, and sets. 1.1 … Read more

Detailed Explanation of Lua File Operations

1. Create and write to a file Creating and writing files are the most basic file operations. You can open a file in write mode (‘w’) and then use the write method to write content. — Define example file pathlocal testFilePath = “test_file.txt”– Open the file for writing (‘w ‘mode: write mode, overwrite if the … Read more

Extracting data from a JSON string using MySQL

Extracting data from a JSON string using MySQL In modern database management, the JSON format is widely used due to its flexibility. However, when data is stored in JSON, we often need to convert it to a more manageable format. This article will demonstrate, through a specific SQL query example, how to extract and reformat … Read more

Git Command Reference

Basic operations # Initialize repositorygit init# Clone remote repositorygit clone <repo_url># View current statusgit status# Add all modifications to the temporary storage areagit add .# Submit to local warehousegit commit -m “submission common”# View Submission History git log –oneline# View file modification differencesgit diff Branch Management # Create a new branchgit branch <branch_name># switch branchgit … Read more