TanDD Blog's

Blog của TanDD – ghi chép về lập trình web, database (MySQL), DevOps và các dự án open-source.

Ubuntu - Install and Run Local LLMs with Ollama

Install Ollama on Ubuntu, pull and run models from the terminal, tune the systemd service, call the REST and OpenAI-compatible APIs, build a custom model with a Modelfile, and keep the server off the public internet.

MySQL - Performance Schema and the sys Schema

How performance_schema instruments the server, statement digests for finding the queries that cost the most, the sys schema views for full scans, unused indexes, lock waits, I/O and memory, SHOW ENGINE INNODB STATUS, the server variables worth checking, and a repeatable tuning workflow.

MySQL - Backups and Point-in-Time Recovery

Logical versus physical backups, consistent dumps with mysqldump and the MySQL Shell dump utilities, XtraBackup, snapshots and CLONE, binary log retention, point-in-time recovery with mysqlbinlog, and how to prove that a backup restores.

MySQL - Replication

How MySQL replication works: the binary log and its formats, server IDs and GTIDs, setting up a source and a replica on MySQL 8.4, seeding a replica with mysqldump or CLONE, measuring lag, read/write splitting, semi-synchronous and multi-threaded replication, Group Replication and failover.

MySQL - Transactions, Locking, Stored Programs, Triggers and SQL Injection

ACID and autocommit, isolation levels and their anomalies, consistent versus locking reads, SKIP LOCKED job queues, deadlocks, stored procedures and functions, cursors and error handlers, triggers, the event scheduler, and how to keep queries safe from SQL injection.

MySQL - Subqueries, CTEs, Window Functions and Views

Scalar, row and column subqueries, the NOT IN NULL trap, EXISTS, derived tables and LATERAL, how the optimizer turns subqueries into semijoins, recursive CTEs, window functions for rankings and running totals, and views as a reuse and permission boundary.

MySQL - Functions, Expressions, Regex and JSON

A practical tour of MySQL 8.4 built-in functions: strings and utf8mb4 lengths, numbers and division, dates and time zones, aggregates, control flow, casting, ICU regular expressions, JSON with indexing, UUIDs and literals.

MySQL - Indexes, EXPLAIN and Full-Text Search

How InnoDB B+tree indexes work, clustered versus secondary indexes, composite and covering indexes, functional, invisible and descending indexes, reading EXPLAIN and EXPLAIN ANALYZE, tuning a real query, the slow query log, and FULLTEXT search.

MySQL - Keys and Constraints

Primary, unique, composite and foreign keys, NOT NULL, DEFAULT and CHECK constraints in MySQL 8.4: how InnoDB uses them, how referential actions behave, how to add, drop and list them, and the error codes they raise.

MySQL - Joins and Set Operations

INNER, LEFT, RIGHT and CROSS joins, self joins for category trees, many-to-many through a link table, USING vs NATURAL JOIN, anti-joins, FULL OUTER JOIN emulation, UPDATE and DELETE with joins, and UNION, INTERSECT and EXCEPT (8.0.31+) with their older emulations.