Tag

primary key

0 views collected around this technical thread.

Java Captain
Java Captain
Apr 24, 2025 · Databases

Why Using UUID as a Primary Key in MySQL Causes Performance Issues and How to Optimize It

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.

DatabaseMySQLOptimization
0 likes · 7 min read
Why Using UUID as a Primary Key in MySQL Causes Performance Issues and How to Optimize It
Architecture Digest
Architecture Digest
Apr 11, 2025 · Databases

Performance Issues of Using UUID as Primary Key in MySQL and Optimization Strategies

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.

Database DesignIndex PerformanceMySQL
0 likes · 7 min read
Performance Issues of Using UUID as Primary Key in MySQL and Optimization Strategies
Architect's Tech Stack
Architect's Tech Stack
Mar 31, 2025 · Databases

Performance Comparison of Auto‑Increment, UUID, and Random Keys in MySQL

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.

IndexingJavaMySQL
0 likes · 9 min read
Performance Comparison of Auto‑Increment, UUID, and Random Keys in MySQL
Aikesheng Open Source Community
Aikesheng Open Source Community
Jan 20, 2025 · Databases

Understanding MySQL 8.0.13 sql_require_primary_key and Resolving Inconsistent Data After Adding Auto‑Increment Primary Keys

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.

InnoDBMySQLReplication
0 likes · 7 min read
Understanding MySQL 8.0.13 sql_require_primary_key and Resolving Inconsistent Data After Adding Auto‑Increment Primary Keys
Top Architect
Top Architect
Jan 15, 2025 · Databases

Performance Comparison of Auto‑Increment, UUID, and Random Keys in MySQL

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.

MySQLUUIDauto-increment
0 likes · 12 min read
Performance Comparison of Auto‑Increment, UUID, and Random Keys in MySQL
Top Architect
Top Architect
Sep 26, 2024 · Databases

Performance Comparison of Auto‑Increment, UUID, and Random Keys in MySQL

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.

DatabaseMySQLUUID
0 likes · 12 min read
Performance Comparison of Auto‑Increment, UUID, and Random Keys in MySQL
Aikesheng Open Source Community
Aikesheng Open Source Community
Sep 11, 2024 · Databases

What Lock Is Acquired When a Primary Key Index Conflict Occurs During INSERT

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.

InnoDBMySQLTransaction
0 likes · 10 min read
What Lock Is Acquired When a Primary Key Index Conflict Occurs During INSERT
JD Tech Talk
JD Tech Talk
Sep 5, 2024 · Databases

Why MySQL Auto‑Increment Primary Keys Can Become Non‑Continuous

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.

DatabaseInnoDBMySQL
0 likes · 11 min read
Why MySQL Auto‑Increment Primary Keys Can Become Non‑Continuous
Architecture Digest
Architecture Digest
Apr 12, 2024 · Databases

Performance Comparison of Auto‑Increment, UUID, and Random Keys in MySQL

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.

Database IndexMySQLUUID
0 likes · 10 min read
Performance Comparison of Auto‑Increment, UUID, and Random Keys in MySQL
Top Architect
Top Architect
Mar 31, 2024 · Databases

Understanding MySQL Auto‑Increment IDs, Their Limits, and Alternative Strategies

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.

DatabaseInnoDBMySQL
0 likes · 10 min read
Understanding MySQL Auto‑Increment IDs, Their Limits, and Alternative Strategies
Aikesheng Open Source Community
Aikesheng Open Source Community
Mar 4, 2024 · Databases

Can Disk Space Be Saved in MySQL by Adding a Primary Key?

The article demonstrates that adding an explicit primary key to a MySQL InnoDB table can dramatically reduce its on‑disk size by eliminating the hidden clustered index, and explains how invisible primary keys can be used when schema changes are not possible.

Disk SpaceInnoDBInvisible Primary Key
0 likes · 9 min read
Can Disk Space Be Saved in MySQL by Adding a Primary Key?
Aikesheng Open Source Community
Aikesheng Open Source Community
Jan 23, 2024 · Databases

Changing a Primary Key to a Composite Key in TDSQL for MySQL: Dealing with sql_require_primary_key

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.

Database AdministrationMySQLTDSQL
0 likes · 7 min read
Changing a Primary Key to a Composite Key in TDSQL for MySQL: Dealing with sql_require_primary_key
Aikesheng Open Source Community
Aikesheng Open Source Community
Nov 14, 2023 · Databases

Understanding Duplicate Indexes on the Same Column in MySQL and Oracle

This article examines why MySQL permits creating multiple identical indexes on the same column, demonstrates the behavior through several tests, compares it with Oracle's stricter restrictions, and explains how the optimizer selects indexes, highlighting practical implications for database design.

MySQLOracleSQL
0 likes · 7 min read
Understanding Duplicate Indexes on the Same Column in MySQL and Oracle
Selected Java Interview Questions
Selected Java Interview Questions
Oct 17, 2023 · Databases

SQL Techniques: Finding Duplicate Records, TRUNCATE vs DELETE, Primary vs Candidate Keys, Second Highest Salary, and Common Interview Queries

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.

DatabaseDuplicate RecordsInterview Questions
0 likes · 9 min read
SQL Techniques: Finding Duplicate Records, TRUNCATE vs DELETE, Primary vs Candidate Keys, Second Highest Salary, and Common Interview Queries
Weimob Technology Center
Weimob Technology Center
Oct 13, 2023 · Big Data

Optimizing StarRocks Tables: Design Tips, Real‑World Cases and Monitoring Strategies

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.

Big DataStarRocksanalytics
0 likes · 25 min read
Optimizing StarRocks Tables: Design Tips, Real‑World Cases and Monitoring Strategies
Selected Java Interview Questions
Selected Java Interview Questions
Jul 6, 2023 · Databases

Why MySQL Discourages UUIDs and Non‑Sequential IDs: Performance Comparison with Auto‑Increment Primary Keys

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.

MySQLUUIDauto-increment
0 likes · 9 min read
Why MySQL Discourages UUIDs and Non‑Sequential IDs: Performance Comparison with Auto‑Increment Primary Keys
Java Architect Essentials
Java Architect Essentials
Jun 20, 2023 · Databases

Performance Comparison of Auto‑Increment, UUID, and Random Keys in MySQL

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.

Database IndexMySQLSpring Boot
0 likes · 9 min read
Performance Comparison of Auto‑Increment, UUID, and Random Keys in MySQL
Architect's Guide
Architect's Guide
Jan 26, 2023 · Databases

Primary Key and Index Design for Distributed Databases

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.

Distributed DatabasesSQLSharding
0 likes · 10 min read
Primary Key and Index Design for Distributed Databases
Top Architect
Top Architect
Jan 6, 2023 · Databases

Why MySQL Discourages UUID Primary Keys and a Performance Comparison of Auto‑Increment, UUID, and Random Long IDs

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.

IndexingMySQLSnowflake ID
0 likes · 11 min read
Why MySQL Discourages UUID Primary Keys and a Performance Comparison of Auto‑Increment, UUID, and Random Long IDs