Question : I am refactoring one of my database tables and I’ve come up with an issue. Specifically, I have […]
Tag: unique-constraint
Should I create a multi-column UNIQUE index?
Question : I have created the following MySQL table, which stores which sections of our site a user visited (and […]
Why does InnoDB allow a 772 byte unique constraint?
Question : I’ve defined a unique constraint for two columns: A bigint and a VARCHAR(256) COLLATE utf8mb4_unicode_ci Then this error […]
SQL Uniqueness Across Multiple Tables
Question : I have two SQL tables: Users and clients. Every row in the users table has a set of […]
Is it better to add an index and search via the index or add a unique constraint and let an insert fail?
Question : I have a table with over 2.5 million records in production that keeps track of if a specific […]
Unexpected unique constraint violation during update
Question : In table foo with two columns (id and seq), I’d like to add +1 to seq for all […]
PostgreSQL relative update breaks unique constraint
Question : I have unique index on column for UPSERT. When I am trying to update column using v = […]
Duplicate UNIQUE KEY error after ROLLBACK in MySQL
Question : I have a table like this mysql> describe seudonimos; +————–+——————+——+—–+———+—————-+ | Field | Type | Null | Key […]
Unique indexed column in where clause and mysql execution after finding first row
Question : Suppose in a table there are 2 columns: login and password login is indexed as unique index, password […]
Best way to model the relationship of unique pairs
Question : I have two tables; one for storing thing and one for storing the relationship between two thing objects. […]