Tagged articles
Primary Key
95 articles · Page 1 of 1
The article explains why OFFSET/LIMIT pagination causes full table scans and linear performance degradation with large offsets, demonstrates a 100k-row benchmark where cursor-based pagination using primary keys runs in 0.01s versus 12.80s for OFFSET, and recommends keyset pagination for scalable systems while noting limitations for tables without unique sequential columns.
Keyset PaginationLIMITOFFSET
0 likes · 7 min read

An in‑depth MySQL benchmark compares auto‑increment, UUID, and Snowflake‑style random long keys, showing how index structure, insert latency, and page fragmentation differ, and explains why auto‑increment keys usually outperform the others while also highlighting the security and lock‑contention drawbacks of sequential IDs.
InnoDB indexPrimary KeySnowflake ID
0 likes · 12 min read

Using UUID as a primary key in MySQL inflates index size, causes random inserts that trigger frequent index and page splits, slows both insert and query operations, and makes updates costly, but techniques such as ordered UUIDs, binary storage, hybrid auto‑increment keys, and table partitioning can mitigate these issues.
Index PerformanceOrdered UUIDPrimary Key
0 likes · 8 min read

This comprehensive guide explains MySQL index fundamentals using a dictionary analogy, covers four essential index types with SQL examples, details six common optimization pitfalls that cause index failure, and demonstrates how to verify index usage with EXPLAIN and SHOW INDEX commands.
B+ TreeComposite IndexEXPLAIN
0 likes · 18 min read

MySQL relies on B+Tree indexes for faster I/O, easy range queries, and stable performance, and InnoDB stores the primary key as a clustered B+Tree where ordered keys prevent page splits that would otherwise degrade speed.
B+ TreeIndexingInnoDB
0 likes · 2 min read

This guide explains why solid MySQL design matters, walks through the three normal forms with concrete SQL examples, covers primary keys, foreign keys, indexes, various table relationships, an online‑store case study, design recommendations, and performance‑tuning techniques.
ER diagramForeign KeyIndexing
0 likes · 15 min read

The article explains three practical methods for achieving API idempotency—leveraging unique database primary keys (with distributed IDs), applying optimistic locking via version fields, and using a global anti‑repeat token stored in Redis—detailing their applicability, requirements, and operational flow.
API IdempotencyOptimistic LockPrimary Key
0 likes · 3 min read

This article analyzes the interview focus on MySQL auto‑increment primary key exhaustion, explains the underlying mechanism, outlines preventive design choices and monitoring, and provides detailed emergency response options, best‑practice recommendations, and common pitfalls for robust database management.
Primary Keyauto-incrementdatabase design
0 likes · 9 min read

Using UUIDs as primary keys in MySQL can dramatically degrade performance on large tables due to larger index size, random inserts causing index splits, slower comparisons, and costly index refreshes on updates, but the impact can be mitigated with ordered UUIDs, binary storage, hybrid keys, or table partitioning.
IndexPrimary Keymysql
0 likes · 8 min read

This article explains the internal mechanics of MySQL 8.0 InnoDB pages, how random primary keys such as UUID cause costly page splits and merges, and provides Java‑level best practices and MySQL commands to optimize primary‑key design for better performance and space utilization.
InnoDBPage MergePage Split
0 likes · 14 min read

Using random UUID primary keys forces PostgreSQL to write to unpredictable index pages, causing heavy CPU usage, large index size, and dramatically higher insert latency, while switching to a sequential bigint key restores performance and reduces write amplification.
Database PerformanceIndexingPostgreSQL
0 likes · 7 min read

This article experimentally compares auto‑increment, UUID and Snowflake‑generated primary keys in MySQL, analyzes their index structures, shows insertion‑time benchmarks, discusses the trade‑offs of each approach, and concludes that sequential auto‑increment keys deliver the best overall performance.
Index PerformanceInnoDBPrimary Key
0 likes · 10 min read

Using UUIDs as primary keys in MySQL can severely degrade performance due to larger index size, random insertion order, and costly updates, but the article explains the underlying reasons and offers practical optimizations such as ordered UUIDs, binary storage, hybrid auto‑increment keys, and table partitioning.
IndexOptimizationPrimary Key
0 likes · 8 min read

This article explains the performance drawbacks of using UUIDs as primary keys in MySQL—including larger indexes, random inserts, and slower comparisons—details why data updates trigger index refreshes, and offers practical optimization techniques such as ordered UUIDs, binary storage, hybrid auto‑increment keys, and table partitioning.
Database PerformancePrimary KeyTable Partitioning
0 likes · 8 min read

This article examines how auto‑increment primary keys work, the limits of common integer types, the failures that occur when those limits are reached, and practical strategies—including type upgrades, distributed ID generators, sharding, and sequence cycling—to prevent and mitigate ID exhaustion in high‑traffic MySQL and PostgreSQL deployments.
PostgreSQLPrimary Keyauto-increment
0 likes · 9 min read

MySQL auto‑increment primary keys are expected to be sequential, but deletions, manual IDs, transaction rollbacks, unique‑key conflicts, and bulk‑insert allocation strategies can all cause gaps, and this article explains each scenario in detail.
Primary Keyauto-incrementdatabase
0 likes · 3 min read

The article explains the drawbacks of traditional random UUIDs as primary keys, introduces the time‑ordered design of UUIDv7, compares it with earlier versions, and provides practical Java code and SQL examples for generating and using UUIDv7 in databases.
Distributed SystemsPrimary KeySQL
0 likes · 8 min read

This article explains the drawbacks of traditional random UUIDs as database primary keys, introduces the time‑ordered UUIDv7 design, shows how its ordered structure improves index performance and storage efficiency, provides Java generation and SQL usage examples, and answers common questions about collisions and clock rollback.
JavaPrimary KeyUUIDv7
0 likes · 9 min read

This article explains why using UUID as a primary key in MySQL can degrade insert, update, and query performance due to large index size, unordered values, and frequent index splits, and offers optimization strategies such as ordered UUIDs, binary storage, combined auto‑increment keys, and table partitioning.
IndexOptimizationPrimary Key
0 likes · 7 min read

The article explains why using UUIDs as primary keys in MySQL large tables leads to poor index efficiency, slower inserts and queries, and costly index refreshes on updates, and then presents practical optimization techniques such as ordered UUIDs, binary storage, hybrid auto‑increment keys, and table partitioning.
Index PerformanceOptimizationPrimary Key
0 likes · 7 min read

This article investigates MySQL's recommendation to avoid UUIDs and non‑sequential keys by benchmarking insert performance of auto‑increment, UUID, and random (snowflake) primary keys, analyzing their index structures, drawbacks, and concluding that sequential auto‑increment keys provide the best overall efficiency.
IndexingJavaPrimary Key
0 likes · 9 min read

This article analyzes why MySQL 8.0.13 introduced the sql_require_primary_key parameter, demonstrates how adding auto‑increment primary keys can cause master‑slave data inconsistencies, explains the underlying InnoDB row‑id behavior, and provides a step‑by‑step solution to synchronize tables.
InnoDBPrimary Keyauto-increment
0 likes · 7 min read

This article investigates why MySQL recommends auto_increment primary keys over UUID or random Snowflake IDs by creating three tables with different key strategies, running Spring‑Boot/JdbcTemplate performance tests, analyzing insertion speed, index structures, and the trade‑offs of each approach.
Index structurePrimary Keyauto_increment
0 likes · 12 min read


ITPUBOct 28, 2024 · Databases
This article explains how MySQL single‑table row limits are determined by primary‑key size, InnoDB page structure, and B+‑tree fan‑out, showing that a table with 100 million rows can still query quickly when the index depth remains low.
B+ TreeIndexPrimary Key
0 likes · 14 min read

This article evaluates MySQL's recommendation to avoid UUID or non‑sequential snowflake IDs by benchmarking three tables—auto‑increment, UUID, and random key—using Spring Boot and JdbcTemplate, then analyzes their index structures, insertion speed, and trade‑offs.
IndexPrimary Keyauto_increment
0 likes · 12 min read

This article examines how InnoDB handles row locking when an INSERT triggers a primary‑key index conflict, detailing the lock types on primary and unique indexes, the implicit‑to‑explicit lock conversion, and the role of the supremum record in the locking process.
InnoDBPrimary KeyTransaction
0 likes · 10 min read

This article explains the mechanisms behind MySQL auto‑increment primary keys, why gaps appear after failed inserts, unique‑index violations, transaction rollbacks, and batch operations, and how storage engines and innodb_autoinc_lock_mode settings influence the continuity of generated IDs.
InnoDBPrimary KeyUnique Index
0 likes · 11 min read

This article explains why MySQL auto‑increment primary keys can become non‑continuous, covering storage mechanisms, unique‑index violations, transaction rollbacks, batch inserts, and step‑size settings, and provides practical examples and diagrams to help developers diagnose and avoid ID gaps.
InnoDBPrimary KeyUnique Index
0 likes · 11 min read


21CTOJun 2, 2024 · Databases
This article explains how using UUIDs as primary keys can degrade insert performance and increase storage requirements, illustrating the impact with a million‑row simulation and offering guidance for better database design in.
Primary KeyStorageuuid
0 likes · 5 min read

This article explores why distributed primary keys are essential for sharding, compares built‑in ShardingSphere ID generation strategies such as UUID, NanoID, Snowflake, CosId and custom algorithms, details their configuration, performance trade‑offs, and provides code examples for implementing and registering custom key generators.
Primary KeyShardingSphereSnowflake
0 likes · 17 min read

This article analyzes why MySQL recommends auto‑increment primary keys over UUIDs or random snowflake IDs by designing three tables, running insert‑select benchmarks with Spring Boot's JdbcTemplate, presenting the test results, and discussing the underlying index‑structure impacts and trade‑offs.
Primary Keyauto-incrementdatabase-index
0 likes · 10 min read

This article explains how MySQL auto‑increment primary keys work, the practical limits of various internal IDs such as auto‑increment, InnoDB row_id, Xid, trx_id, and thread_id, and compares them with external solutions like Redis‑based auto‑increment keys, providing guidance on choosing the right approach for different scenarios.
InnoDBPrimary Keyauto-increment
0 likes · 10 min read

This article explains why TDSQL for MySQL refuses to drop a primary key when the sql_require_primary_key variable is ON, analyzes the underlying parameter behavior, and provides two practical solutions—temporarily disabling the variable or combining drop and add statements—to safely convert a single‑column primary key into a composite key.
Primary KeyTDSQLcomposite key
0 likes · 7 min read

The article explains why analytical databases struggle with real‑time data changes due to columnar storage, complex indexes and distributed processing, and then details StarRocks' primary‑key model, adaptive update mode, bitmap indexes, row/column partial updates, and practical SQL upsert techniques to achieve low‑latency updates without sacrificing query performance.
Partial UpdatePrimary KeyReal-Time Update
0 likes · 15 min read

This article introduces SQL as the standard language for relational databases, explains how data is organized into tables with primary and foreign keys, and walks through essential keywords like SELECT, WHERE, and JOIN to query and relate data effectively.
Foreign KeyPrimary KeySQL
0 likes · 5 min read

This article explains how to locate duplicate rows in a table, contrasts TRUNCATE and DELETE commands, clarifies the difference between primary and candidate keys, demonstrates queries for retrieving the second highest salary, and provides a collection of typical SQL interview questions with sample code.
Interview questionsPrimary KeySQL
0 likes · 9 min read

This article explains how to design efficient StarRocks tables with proper field types, partitioning and bucketing, compares update and primary‑key models, presents real‑world cases of memory and tablet issues, provides a complete table‑creation example, and outlines comprehensive monitoring metrics to keep the analytical data warehouse performant and stable.
AnalyticsPartitioningPrimary Key
0 likes · 25 min read


21CTOSep 28, 2023 · Databases
This article outlines eight frequent database design pitfalls—ignoring data purpose, poor normalization, redundancy, weak referential integrity, underusing engine features, composite primary keys, bad indexing, and confusing naming conventions—and provides practical guidance on how to avoid or correct each issue.
Best PracticesIndexingPrimary Key
0 likes · 10 min read


ITPUBSep 20, 2023 · Databases
This article compares UUID and auto‑increment primary keys in MySQL, explaining how each is generated, their advantages and drawbacks, performance implications, and practical guidance on selecting the right key type for different business scenarios.
Primary Keyauto-incrementdatabase design
0 likes · 7 min read

This article analyzes MySQL's recommendation against UUIDs and non‑sequential keys by benchmarking three tables—auto‑increment, UUID, and random snowflake IDs—using a Spring Boot JdbcTemplate test, revealing that sequential primary keys provide superior insert performance and lower index fragmentation.
IndexPrimary Keyauto-increment
0 likes · 9 min read

This article analyzes why MySQL recommends auto_increment primary keys over UUID or non‑sequential Snowflake IDs by creating three tables, running Spring Boot/JdbcTemplate performance tests, and examining index structures, lock contention, and fragmentation to guide optimal primary‑key selection.
Primary KeySpring Bootauto-increment
0 likes · 9 min read

The article explains why auto‑increment primary keys are unsuitable for sharded databases, recommends globally unique ordered identifiers, and details index and global‑table strategies—including redundant tables, index tables, and embedding shard information in keys—to achieve efficient single‑shard queries.
Primary KeySQLdistributed databases
0 likes · 10 min read

This article investigates MySQL's recommendation against using UUIDs as primary keys by creating three tables with auto‑increment, UUID, and random (snowflake) keys, running insertion benchmarks with Spring Boot/JdbcTemplate, analyzing index structures, and discussing the advantages and drawbacks of each key strategy.
IndexingPrimary KeySnowflake ID
0 likes · 11 min read

This article investigates MySQL's recommendation against using UUID or non‑sequential keys, builds three tables with auto‑increment, UUID, and random (snowflake) primary keys, runs insertion and query benchmarks using Spring Boot and JdbcTemplate, analyzes index structures, and discusses the advantages and drawbacks of each approach.
Primary Keydatabase-indexmysql
0 likes · 11 min read

The article presents a detailed performance comparison between auto‑increment integer primary keys and UUID string primary keys in MySQL, including table definitions, 5‑million‑row and 10‑million‑row test results for read, range, write, backup, and storage efficiency, and offers practical recommendations for choosing the appropriate key strategy in distributed environments.
Primary Keyauto-incrementmysql
0 likes · 13 min read

Effective index and primary key design in distributed database architectures requires using globally unique, ordered identifiers instead of auto‑increment keys, embedding shard information in keys, employing auxiliary index tables, and handling global tables to ensure queries target a single shard, thereby preserving scalability and performance.
Primary Keydistributed databasesglobal tables
0 likes · 11 min read

This article examines the DBLE distributed database middleware cache, reproduces a primary‑key update query that returns incomplete results due to stale routing cache, analyzes cache contents via the management console, explains the cache’s behavior and limitations, and shows how disabling the primary‑key cache restores correct query routing.
CacheDBLEPrimary Key
0 likes · 10 min read

The article explains why auto‑increment primary keys are unsuitable for sharded databases, recommends using globally unique ordered identifiers such as UUIDs or Snowflake IDs, and discusses index design strategies—including index tables, embedding shard keys, and handling global tables—to ensure efficient single‑shard queries.
Primary Keydistributed databasesglobal tables
0 likes · 10 min read

This article investigates MySQL’s recommendation against UUIDs, comparing auto‑increment, UUID, and Snowflake‑style random keys through insertion and query benchmarks, analyzing their index structures, performance impacts, and trade‑offs, and concludes why sequential primary keys generally outperform non‑sequential identifiers.
IndexPrimary Keyauto_increment
0 likes · 12 min read

This article compiles essential MySQL interview questions covering primary and candidate keys, date functions, trigger limits, index column counts, data copying techniques, core MySQL concepts, feature highlights, transaction ACID properties, heap versus clustered tables, numeric type differences, and objects creatable with CREATE statements.
Heap TableInterview questionsPrimary Key
0 likes · 9 min read

This article explains the design and implementation of StarRocks 2.x Primary Key tables, covering real‑time update mechanisms, write and commit workflows, in‑memory primary indexing, compaction, read‑path optimizations, performance benchmarks, and upcoming features such as partial and conditional updates.
IndexingOLAPPrimary Key
0 likes · 19 min read

This article investigates MySQL's recommendation against UUID primary keys by creating three tables—auto‑increment, UUID, and random (snowflake) keys—running insert and query benchmarks with SpringBoot/JdbcTemplate, analyzing index structures, and discussing the performance trade‑offs and security considerations of each key strategy.
IndexPrimary Keyauto-increment
0 likes · 11 min read

This article evaluates MySQL insertion performance of three primary key strategies—auto‑increment, UUID, and random Snowflake‑like keys—by building identical tables, running Spring‑Boot/JdbcTemplate benchmarks, analyzing index structures, and discussing the advantages and drawbacks of each approach.
Primary Keyauto-incrementmysql
0 likes · 9 min read

StarRocks 1.19 introduces a Global Runtime Filter that speeds up joins up to six‑fold, adds BE‑level disk balancing, launches an experimental Primary Key table type with near‑duplicate‑key read performance, enables external‑table writes between clusters, and includes a host of CPU‑cache and query‑optimizations.
External TableOptimizationPrimary Key
0 likes · 7 min read

This article explains the various types of auto‑increment identifiers in MySQL—including table primary keys, InnoDB row_id, Xid, trx_id, thread_id—and discusses their maximum values, overflow behavior, and alternative solutions such as using Redis for external unique keys.
InnoDBPrimary Keyauto-increment
0 likes · 8 min read

This article explains the fundamentals of MySQL indexing, covering the purpose, optimization principles, various index types such as hash, B‑tree and B+‑tree, the structure of primary‑key and secondary indexes, index pages, and the concept of back‑table lookups, providing clear diagrams and examples.
B+TreeIndexPrimary Key
0 likes · 15 min read

A developer encountered a duplicate‑key error caused by an unexpected primary‑key update that overflowed the signed INT limit, exposing a hidden MySQL auto‑increment bug that persisted across normal inserts until a later DDL operation triggered failures, a problem present in Percona 5.6/5.7 but fixed in MySQL 8.0.
PerconaPrimary Keyauto-increment
0 likes · 5 min read


ITPUBApr 28, 2021 · Databases
This article explains the fundamentals of MySQL table‑lookup (回表) operations, compares primary‑key and secondary‑index structures, illustrates how low‑version MySQL performs lookups for every matching row, and shows how index pushdown in MySQL 5.6+ reduces unnecessary lookups for better performance.
Index PushdownPrimary KeyTable Lookup
0 likes · 6 min read

This article evaluates the insertion speed and index impact of three MySQL primary‑key strategies—auto‑increment, UUID, and Snowflake‑generated long IDs—by building identical tables, running a Spring Boot/JdbcTemplate benchmark, and analyzing the resulting performance and structural differences.
Primary KeySnowflake IDdatabase-index
0 likes · 9 min read

This article explains how MySQL unique indexes influence auto‑increment behavior, compares unique constraints with primary keys, and demonstrates three techniques—INSERT IGNORE, REPLACE INTO, and INSERT … ON DUPLICATE KEY UPDATE—to avoid duplicate‑key errors, including their effects on auto‑increment values and potential deadlocks.
Duplicate KeyINSERT IGNOREPrimary Key
0 likes · 10 min read

This article explains how MySQL UNIQUE indexes affect data insertion and auto‑increment behavior, compares them with primary keys, and presents three techniques—INSERT IGNORE, REPLACE INTO, and INSERT … ON DUPLICATE KEY UPDATE—to prevent duplicate‑key failures, including deadlock considerations.
Duplicate KeyINSERT IGNOREPrimary Key
0 likes · 8 min read

This article explains MySQL AUTO_INCREMENT behavior, demonstrates creating tables with unsigned int primary keys, shows how to set and inspect the AUTO_INCREMENT value, discusses its maximum limits, and recommends using bigint or explicit primary keys to avoid overflow and duplicate‑key errors.
BIGINTPrimary Keyauto-increment
0 likes · 4 min read

This article investigates why MySQL recommends auto_increment over UUID or non‑sequential snowflake IDs by creating three tables, running insert and query benchmarks with Spring Boot and JdbcTemplate, analyzing index structures, and summarizing the performance trade‑offs and security considerations of each primary‑key strategy.
IndexingPrimary Keyauto-increment
0 likes · 10 min read

This article explains how MySQL integer auto‑increment primary keys can reach their maximum value, the resulting duplicate‑key errors, and how using BIGINT or understanding InnoDB's internal row_id behavior can prevent data loss or crashes.
BIGINTDatabase LimitsPrimary Key
0 likes · 6 min read

This article explains several efficient methods—including shell scripts, generated series tables, JSON functions, and MySQL 8.0 recursive CTEs—to quickly locate missing auto‑increment primary key values in a MySQL table, comparing their performance and suitability.
CTEPrimary KeySQL
0 likes · 12 min read

The article explains the concept and requirements of primary keys in MySQL, outlines best practices such as avoiding updates and reuse, and discusses how primary keys serve as clustered indexes in InnoDB, highlighting the performance advantages of using business‑agnostic auto‑increment IDs over random keys.
InnoDBPrimary Keyauto-increment
0 likes · 7 min read

This article examines MySQL's recommendation to use auto_increment primary keys instead of UUID or random snowflake IDs by creating three tables, running insertion benchmarks with Spring Boot and JdbcTemplate, and analyzing how index structure affects performance and scalability.
IndexPrimary Keyauto-increment
0 likes · 10 min read

This article explains MySQL primary key design principles, compares auto‑increment, UUID and uuid_short approaches, provides SQL examples and performance benchmarks, and offers guidance on choosing business‑related versus unrelated key columns for optimal data integrity and query efficiency.
Primary KeySQLauto-increment
0 likes · 12 min read

This article outlines essential database design concepts, covering the relationship between source documents and entities, primary‑foreign key design, basic table characteristics, normalization standards, handling many‑to‑many relationships, primary key strategies, data redundancy, ER‑diagram considerations, view usage, and performance‑boosting techniques.
Foreign KeyPerformance OptimizationPrimary Key
0 likes · 12 min read

This article creates three MySQL tables with auto‑increment, UUID, and Snowflake‑generated random keys, runs identical insert workloads using Spring Boot and JdbcTemplate, measures performance, compares index structures, discusses the pros and cons of each key type, and concludes with best‑practice recommendations.
IndexPrimary KeySpring Boot
0 likes · 10 min read

This article investigates why MySQL recommends auto_increment primary keys over UUID or snowflake IDs by creating three tables with different key strategies, running insertion benchmarks using Spring Boot, and analyzing index structures, performance results, and the trade‑offs of each approach.
Primary Keyauto-incrementdatabase-index
0 likes · 10 min read

This article investigates MySQL's recommendation against UUID primary keys by creating three tables with auto‑increment, UUID, and random Snowflake IDs, benchmarking insert and query speeds using Spring JDBC, analyzing index structures, and discussing the trade‑offs of each approach.
IndexPrimary Keydatabase
0 likes · 11 min read

This article reviews common primary key generation methods—including auto‑increment drawbacks and five alternatives such as UUID, step, segment, Snowflake, and Redis—explaining their mechanisms, advantages, and trade‑offs to help you select the best fit for high‑concurrency and distributed systems.
Primary KeySnowflakedatabase
0 likes · 9 min read

This article presents a comprehensive guide to database design, covering the relationship between source documents and entities, primary and foreign keys, table properties, normalization standards, handling many‑to‑many relationships, key selection, data redundancy, ER diagram considerations, view usage, intermediate and temporary tables, integrity constraints, the "Three‑Few" principle, and practical techniques for improving database performance.
ER diagramForeign KeyPerformance Optimization
0 likes · 14 min read

An in‑depth investigation shows that counting rows with COUNT(*) on a MySQL table using the PRIMARY key index can be slower than a full table scan, revealing differences in execution plans, optimizer behavior, logical reads, and profiling data that explain the 0.02‑second performance gap.
COUNTPrimary Keyexecution plan
0 likes · 15 min read

The article explains why MySQL's AUTO_INCREMENT primary keys can become non‑monotonic and non‑continuous due to early‑version in‑memory counters, restart behavior, concurrency lock modes, and how MySQL 8.0 persists the counter to mitigate these issues while discussing design trade‑offs and best practices.
InnoDBPrimary Keyauto-increment
0 likes · 11 min read

This article explains the performance drawbacks of using UUIDs as primary keys in MySQL InnoDB tables, analyzes their impact on storage, I/O and CPU, and presents several mitigation strategies such as time‑ordered UUIDs, integer mapping, and alternative identifier schemes.
InnoDBPrimary KeySQL
0 likes · 14 min read

This article explains the relationships between source documents and entities, the role of primary and foreign keys, the characteristics of base tables, normalization standards, handling many‑to‑many relationships, primary‑key generation methods, data redundancy concepts, ER‑diagram best practices, view usage, and performance‑optimizing techniques for relational databases.
ER diagramForeign KeyPrimary Key
0 likes · 14 min read

This article explores MySQL's hidden rowid concept, demonstrates how to observe its existence, explains its relationship with primary keys, highlights the risks of primary‑key misuse, and provides a step‑by‑step test that reveals rowid's potential overflow bottleneck.
InnoDBPrimary KeySQL debugging
0 likes · 11 min read

After splitting a database into multiple shards, generating globally unique primary keys becomes essential, and this article examines various solutions—including auto‑increment IDs, sequence steps, UUIDs, timestamp concatenation, and the Snowflake algorithm—detailing their advantages, drawbacks, and suitable scenarios.
Primary KeySnowflakeid-generation
0 likes · 11 min read

This article explains how InnoDB stores data using B‑Tree primary keys, why explicit primary keys are essential, and compares ordered versus random insert patterns, illustrating their impact on page fill factor, index size, and query performance with practical sysbench examples.
B+ TreeDatabase IndexingInnoDB
0 likes · 15 min read

This article explains the three fundamental normal forms (1NF, 2NF, 3NF) and the five major database constraints, detailing how to apply primary and foreign keys, their syntax, and reference actions to design robust relational schemas.
3NFForeign KeyPrimary Key
0 likes · 6 min read

This article explains why auto‑increment primary keys are preferred, compares B+‑tree and hash indexes, discusses MySQL partitioning, isolation levels, MVCC, and provides practical tips for designing efficient database tables and indexes.
MVCCPartitioningPrimary Key
0 likes · 19 min read

This article examines the definitions, advantages, and trade‑offs of logical (surrogate), business (natural), and composite primary keys in relational databases, offering practical guidelines and best‑practice recommendations for selecting the most suitable key strategy.
Primary KeySQL Serverbusiness key
0 likes · 11 min read

This article walks through choosing a web framework and database, introduces relational databases, explains design steps such as requirement analysis, table creation, primary key selection, relationship modeling (one‑to‑many, many‑to‑many, one‑to‑one) with SQL examples, and covers normalization forms, integrity rules, and indexing strategies.
Foreign KeyPrimary KeySQL
0 likes · 19 min read

This article explains the necessity of globally unique and trend‑ordered identifiers for business systems, compares database auto‑increment, UUID, Redis, Snowflake, and MongoDB ObjectId solutions, and outlines their advantages, drawbacks, and best‑practice design criteria.
MongoDBPrimary KeySnowflake
0 likes · 13 min read


21CTOOct 31, 2017 · Databases
This article explains InnoDB's record storage mechanics, compares auto‑increment and business primary keys, details primary, secondary, and composite index structures, and shares practical table‑design guidelines and real‑world case studies from ZhaiZhai's MySQL usage.
Composite IndexInnoDBPrimary Key
0 likes · 12 min read

This article explains InnoDB storage mechanics, compares auto‑increment and business primary keys, details primary, secondary, and composite index structures, and presents practical table‑design principles and real‑world case studies from ZhaiZhai's services to guide developers in building efficient MySQL schemas.
InnoDBPrimary KeyTable Design
0 likes · 12 min read

An overview of relational database normalization explains the three normal forms—1NF, 2NF, and 3NF—and details the five essential constraints (primary key, unique, default, foreign key, not null), including practical examples, rules, and foreign‑key syntax for proper schema design.
Foreign KeyNormal FormsPrimary Key
0 likes · 6 min read

This article explains core database concepts—including entities, attributes, relationships, the three normal forms, primary and foreign key rules, and the five main constraints—providing clear examples and visual diagrams to help developers design robust relational schemas.
Foreign KeyNormal FormsPrimary Key
0 likes · 6 min read

This article explains the data structures and algorithms behind MySQL indexing, covering B‑Tree fundamentals, insertion and deletion steps with visual examples, the differences between B‑Tree and B+Tree, InnoDB's clustered and secondary index implementations, and why monotonically increasing primary keys improve performance.
B+ TreeB-TreeIndexing
0 likes · 15 min read

This article provides a step-by-step guide on creating and managing MySQL indexes (including INDEX and UNIQUE), defining primary keys with AUTO_INCREMENT, establishing foreign key relationships with cascade updates/deletes, and configuring the default storage engine, illustrated with practical SQL commands and examples.
Foreign KeyPrimary KeySQL
0 likes · 11 min read


ITPUBApr 11, 2016 · Databases
A MySQL replica was consuming an entire CPU core due to single‑process replication, and analysis of binlog and InnoDB status revealed heavy row locks on a table without a primary key, which was resolved by adding an auto‑increment ID, dropping CPU usage to 3% and eliminating replication lag.
CPUInnoDBPrimary Key
0 likes · 5 min read


21CTOSep 27, 2015 · Databases
This article explains two key relational database design techniques: using auto‑increment or UUID physical primary keys for foreign key relationships, and employing optimistic locking with a version column to safely handle concurrent updates, while also covering when locks can be omitted.
Foreign KeyOptimistic LockPrimary Key
0 likes · 6 min read


21CTOSep 16, 2015 · Databases
This article explains why using a physical primary key for foreign‑key relationships, how to implement optimistic locking with a version column for concurrent updates, and when it’s safe to update records without any locking, providing practical SQL examples for reliable database design.
Foreign KeyOptimistic LockPrimary Key
0 likes · 6 min read
