Tagged articles

unique constraint

5 articles · Page 1 of 1
Top Architect
Top Architect
Jul 11, 2021 · Databases

Handling Duplicate Inserts in MySQL: Strategies and MyBatis Batch Example

The article discusses efficient ways to perform bulk inserts in MySQL while avoiding duplicate records, covering techniques such as INSERT IGNORE, ON DUPLICATE KEY UPDATE, INSERT…SELECT…WHERE NOT EXISTS, REPLACE INTO, and demonstrates a practical MyBatis implementation with a unique mobile_number constraint.

Batch InsertINSERT IGNOREMyBatis
0 likes · 5 min read
Handling Duplicate Inserts in MySQL: Strategies and MyBatis Batch Example
360 Zhihui Cloud Developer
360 Zhihui Cloud Developer
May 13, 2021 · Databases

Why MongoDB’s Unique Index Fails When Index Keys Exceed 1024 Bytes

The article reproduces a MongoDB issue where queries using a hashed shard key return no results and a compound unique index silently accepts duplicate documents, explains that the failIndexKeyTooLong parameter allows oversized index entries to be stored without indexing, and shows how to reproduce and fix the problem.

Hash ShardingMongoDBfailIndexKeyTooLong
0 likes · 34 min read
Why MongoDB’s Unique Index Fails When Index Keys Exceed 1024 Bytes
Qunar Tech Salon
Qunar Tech Salon
Jun 11, 2017 · Databases

Techniques for Removing Duplicate Rows and Adding Unique Constraints in PostgreSQL

This article examines common scenarios where duplicate rows prevent creating unique constraints, presents eight SQL‑based methods—including array functions, window functions, NOT IN/EXISTS, combined IN/NOT IN, EXISTS/NOT EXISTS, single‑statement deletes, and table‑copy approaches—provides test data, performance comparisons, and practical guidance for DBA operations.

Database AdministrationPostgreSQLduplicate rows
0 likes · 10 min read
Techniques for Removing Duplicate Rows and Adding Unique Constraints in PostgreSQL