Using Primary Key Parts In A Secondary Index Of An InnoDB Table
Recently, I was asked what would happen if a primary key was explicitly put into a secondary index of an InnoDB table. For example, given a tableemployees
, ... read more
employees
, ... read more
Extra
confusing
EXPLAIN
ing your queries more, I commend you: you're on the path to becoming a database query optimiser extraordinaire. You may have also identified that the Extra
column isn't a singleton value. You may have even seen something weird like Using where;
... read more
OR
not
user
table. We also started to build an understanding of when MySQL can and shouldn't use an index for a query, but we omitted one fun fact. ... read more
REPLACE
your expectations
INSERT ... ON DUPLICATE KEY UPDATE
and INSERT IGNORE
, surely we can use REPLACE INTO
to upsert a row, right?! And yes, you can, if you want a DoS IGNORE
at your own peril
INSERT ... ON DUPLICATE KEY UPDATE
can unknowingly result in not-completely-expected situations. To get around that, you may have thought to use INSERT IGNORE
, instead. Often, INSERT IGNORE
is used when attempting to insert a row that may already exist. The underlying expectation a ... read more
ON DUPLICATE KEY LEAK DATA
CHECK
ered past
ADD CONSTRAINT is_even_ck CHECK(my_int_col % 2 = 0)
to ensure that the value of the my_int_col
column in every row ... read more
ORDER BY
ORDER BY
is implementation specific. This means that the same query without an ORDER BY
clause run n
times may return rows in n
different orders. ... read more