Tagged articles
26 articles
Page 1 of 1
Top Architect
Top Architect
Nov 9, 2025 · Backend Development

Mastering Idempotency: 4 Proven Techniques for Reliable Backend Operations

This article explains four common idempotency strategies—token, database unique index, distributed lock, and request‑body digest—detailing their core ideas, key concepts, and providing ready‑to‑copy Spring/Redis code examples to prevent duplicate requests in high‑traffic backend systems.

IdempotencyTokenUnique Index
0 likes · 10 min read
Mastering Idempotency: 4 Proven Techniques for Reliable Backend Operations
ITPUB
ITPUB
Nov 9, 2024 · Databases

Why MySQL Unique Indexes Still Allow Duplicates and How to Fix Them

This article explains why a MySQL 8 InnoDB table with a unique index can still store duplicate rows—especially when indexed columns contain NULL or when logical deletion is used—and presents several practical strategies, including status counters, timestamps, extra IDs, hash fields, and batch‑insert techniques, to enforce true uniqueness.

Batch InsertHash FieldInnoDB
0 likes · 14 min read
Why MySQL Unique Indexes Still Allow Duplicates and How to Fix Them
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.

InnoDBUnique Indexauto_increment
0 likes · 11 min read
Why MySQL Auto‑Increment Primary Keys Can Become Non‑Continuous
JD Cloud Developers
JD Cloud Developers
Sep 5, 2024 · Databases

Why Do MySQL Auto‑Increment IDs Skip? Understanding Gaps and Solutions

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.

InnoDBUnique Indexauto_increment
0 likes · 11 min read
Why Do MySQL Auto‑Increment IDs Skip? Understanding Gaps and Solutions
Aikesheng Open Source Community
Aikesheng Open Source Community
Jun 6, 2023 · Databases

Why Does Inserting a Record that Triggers a Unique Index Conflict Add a Next‑Key Exclusive Lock on the Primary‑Key Supremum Record?

This article reproduces a MySQL 8.0.32 InnoDB scenario where inserting a row that violates a unique index causes a next‑key exclusive lock on the primary‑key supremum record, explains the underlying implicit‑lock mechanism, walks through the relevant source‑code stack, and details the lock‑conversion and rollback steps under REPEATABLE‑READ isolation.

Database InternalsInnoDBRepeatable Read
0 likes · 25 min read
Why Does Inserting a Record that Triggers a Unique Index Conflict Add a Next‑Key Exclusive Lock on the Primary‑Key Supremum Record?
ITPUB
ITPUB
Feb 18, 2023 · Databases

Why MySQL Unique Index Fails with unique_checks=0 and How to Resolve It

In MySQL 5.7 replication, disabling unique_checks can cause duplicate‑key errors on a unique index that is not a primary key, leading to replication stalls, and this guide explains the root cause, temporary and permanent fixes, and step‑by‑step reproduction instructions.

ReplicationUnique Indexbug
0 likes · 7 min read
Why MySQL Unique Index Fails with unique_checks=0 and How to Resolve It
Selected Java Interview Questions
Selected Java Interview Questions
Nov 1, 2022 · Databases

Understanding MySQL Unique Index Pitfalls and Practical Solutions

This article examines why a MySQL InnoDB table with a unique index can still store duplicate rows—especially when indexed columns contain NULL values or when logical deletion is used—and presents several practical strategies such as adjusting delete status, adding timestamp or auxiliary ID fields, using hash columns, and leveraging proper bulk‑insert techniques to enforce uniqueness effectively.

Database designHashLogical Delete
0 likes · 13 min read
Understanding MySQL Unique Index Pitfalls and Practical Solutions
Java Backend Technology
Java Backend Technology
Oct 22, 2022 · Databases

Why MySQL Unique Indexes Fail with NULL and How to Fix Them

This article explains why a unique index in MySQL can still allow duplicate rows when indexed columns contain NULL, explores the challenges of adding unique indexes to logically deleted tables, and presents practical solutions such as incremental delete status, timestamps, extra IDs, hash fields, and proper batch insertion techniques.

Database designLogical DeleteUnique Index
0 likes · 13 min read
Why MySQL Unique Indexes Fail with NULL and How to Fix Them
dbaplus Community
dbaplus Community
Oct 3, 2022 · Databases

Why MySQL Unique Indexes Still Allow Duplicates and How to Fix Them

This article explains why a MySQL InnoDB table with a unique index can still contain duplicate rows—especially when indexed columns contain NULL values or when logical deletion is used—and presents several practical strategies, including schema changes and alternative locking mechanisms, to enforce true uniqueness.

Database designLogical DeleteUnique Index
0 likes · 13 min read
Why MySQL Unique Indexes Still Allow Duplicates and How to Fix Them
Liangxu Linux
Liangxu Linux
Aug 22, 2022 · Databases

Why MySQL Unique Indexes Fail with NULL and How to Fix Them

This article explains why a MySQL UNIQUE index does not prevent duplicate rows when indexed columns contain NULL, explores the complications of logical‑delete tables, and presents practical solutions such as incrementing delete status, adding timestamps, delete‑id keys, hash fields, and proper batch inserts.

Database designIndex OptimizationLogical Delete
0 likes · 15 min read
Why MySQL Unique Indexes Fail with NULL and How to Fix Them
macrozheng
macrozheng
Aug 16, 2022 · Databases

Why MySQL Unique Indexes Still Allow Duplicates and How to Fix Them

This article explores a common MySQL InnoDB pitfall where unique indexes fail to prevent duplicate rows, explains how NULL values and logical deletion affect uniqueness, and presents practical strategies—including composite keys, delete status counters, timestamps, hash fields, and Redis locks—to enforce true uniqueness.

Database designLogical DeleteUnique Index
0 likes · 14 min read
Why MySQL Unique Indexes Still Allow Duplicates and How to Fix Them
Su San Talks Tech
Su San Talks Tech
Aug 4, 2022 · Databases

Why MySQL Unique Indexes Still Allow Duplicates and How to Fix Them

This article explains why a unique index on a MySQL InnoDB table may still permit duplicate rows, especially when indexed columns contain NULL values or when logical deletion is used, and presents practical solutions such as adjusting index fields, adding timestamps, hash columns, or redesigning delete logic.

Logical DeleteUnique Indexmysql
0 likes · 14 min read
Why MySQL Unique Indexes Still Allow Duplicates and How to Fix Them
360 Tech Engineering
360 Tech Engineering
May 7, 2021 · Databases

MongoDB Sharding Key Query Failure and Unique Index Violation Explained

This article reproduces a MongoDB issue where queries using a hashed sharding key return no results and a unique compound index appears to fail, then explains the root cause—index entries exceeding the 1024‑byte limit and the failIndexKeyTooLong parameter—providing step‑by‑step commands, configuration changes, and practical recommendations.

Unique IndexfailIndexKeyTooLongindexing
0 likes · 35 min read
MongoDB Sharding Key Query Failure and Unique Index Violation Explained
Code Ape Tech Column
Code Ape Tech Column
Mar 16, 2021 · Databases

How Unique Indexes Affect Auto-Increment and How to Handle Duplicate Keys in MySQL

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 IGNOREREPLACE INTO
0 likes · 10 min read
How Unique Indexes Affect Auto-Increment and How to Handle Duplicate Keys in MySQL
Architecture Digest
Architecture Digest
Mar 15, 2021 · Databases

Impact of UNIQUE Indexes in MySQL and Strategies to Avoid Duplicate Key Errors

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 IGNOREREPLACE INTO
0 likes · 8 min read
Impact of UNIQUE Indexes in MySQL and Strategies to Avoid Duplicate Key Errors
JavaEdge
JavaEdge
Jul 25, 2020 · Databases

Should You Use Unique Indexes in MySQL? Performance Impact of Change Buffer

This article explains the differences between normal and unique indexes in MySQL, examines how they affect query and update performance, details InnoDB's change‑buffer mechanism, and provides practical guidance on when to prefer ordinary indexes for better write efficiency.

Change BufferInnoDBUnique Index
0 likes · 13 min read
Should You Use Unique Indexes in MySQL? Performance Impact of Change Buffer
Selected Java Interview Questions
Selected Java Interview Questions
Mar 6, 2020 · Databases

Best Practices for Choosing Database Indexes

This article outlines essential principles for selecting and managing database indexes, covering unique indexes, indexing frequently sorted or filtered columns, limiting index count, using short or prefix indexes, removing unused indexes, left‑most prefix matching, column cardinality, avoiding functions on indexed columns, and extending existing indexes.

Performance OptimizationUnique Indexindex design
0 likes · 7 min read
Best Practices for Choosing Database Indexes
Qunar Tech Salon
Qunar Tech Salon
Jun 27, 2017 · Databases

Database Deadlock Cases and Their Resolutions

This article examines three real‑world MySQL deadlock incidents—unique‑key null insertion, concurrent duplicate‑key insertion, and a JDBC parameter bug—detailing their detection, analysis, and the concrete fixes applied to prevent recurrence.

JDBCUnique Indexdeadlock
0 likes · 9 min read
Database Deadlock Cases and Their Resolutions
ITPUB
ITPUB
Apr 26, 2016 · Databases

Why Deleting a Single Row by Unique Index Can Still Cause MySQL Deadlocks

This article analyzes a puzzling MySQL deadlock scenario where concurrent DELETE statements on a uniquely indexed row lead to a deadlock, explaining the lock modes, InnoDB's deadlock‑prevention strategy, and the conditions that make such deadlocks possible.

InnoDBRepeatable ReadUnique Index
0 likes · 13 min read
Why Deleting a Single Row by Unique Index Can Still Cause MySQL Deadlocks
ITPUB
ITPUB
Nov 16, 2015 · Databases

Mastering Flash‑Sale (秒杀) Logic: Using Unique Indexes and SQL for Concurrency Control

This guide explains two flash‑sale scenarios—single‑item seckill with a unique index and multi‑item seckill with quantity tracking—detailing table structures, SQL statements, concurrency handling, advantages, drawbacks, and an optimized version without locks, illustrated with step‑by‑step diagrams.

SQLUnique Indexconcurrency
0 likes · 5 min read
Mastering Flash‑Sale (秒杀) Logic: Using Unique Indexes and SQL for Concurrency Control