@PrecisionSQL

6 Followers
2 Following
213 Posts
Daily SQL boosts to help you write better queries with zero confusion

Why does this SQL ORDER BY in subquery get ignored?

Why does this SQL ORDER BY in subquery get ignored. The SQL code uses ORDER BY inside a derived table. In MySQL without LIMIT the optimizer ignores it. In SQL the order you expect is not the order you get.

#whatswrongwiththissqlquery #sqlbug #sqlproductionbug #sqldebugging #sqldatabase #sqlcodereview #sqlperformance #sqlreliability #sqlanalytics #sqldataintegrity #sqlengineering #sqlorderby #sql...

https://www.youtube.com/watch?v=f4mdNHOjKTg

Why does this SQL ORDER BY in subquery get ignored? #sqldebugging

YouTube

How to Stop Bulk INSERT From Locking the Table Forever

Big inserts can block every other query.

#mysql #bulkinsert #locks #howto #performance #batch

https://www.youtube.com/watch?v=dBCt724Pors

How to Stop Bulk INSERT From Locking the Table Forever #bulkinsert

YouTube

How to Use IGNORE INDEX When Optimizer Picks Wrong Plan

MySQL sometimes chooses the slow path.

#mysql #ignoreindex #optimizer #howto #performance #hint

https://www.youtube.com/watch?v=2Ps5kMfBEe0

How to Use IGNORE INDEX When Optimizer Picks Wrong Plan #performance

YouTube

How to Stop Decimal Precision From Losing Money

Floating point can silently drop cents.

#mysql #decimal #float #howto #money #bug

https://www.youtube.com/watch?v=25gvtTJ21QA

How to Stop Decimal Precision From Losing Money #money

YouTube

Why does this SQL phantom read show rows that vanish?

Why does this SQL phantom read show rows that vanish. The SQL code runs REPEATABLE READ. In MySQL another transaction can insert matching rows. In SQL you see rows in one read that disappear in the next.

#whatswrongwiththissqlquery #sqlbug #sqlproductionbug #sqldebugging #sqldatabase #sqlcodereview #sqlperformance #sqlreliability #sqlanalytics #sqldataintegrity #sqlengineering #sqlphantomread ...

https://www.youtube.com/watch?v=2HZvRkzESXA

Why does this SQL phantom read show rows that vanish? #sqlproductionbug

YouTube

Why does this SQL ORDER BY RAND() melt the database?

Why does this SQL ORDER BY RAND() melt the database. The SQL code uses ORDER BY RAND() for random rows. In MySQL that sorts the entire table. In SQL one query can take down the server.

#whatswrongwiththissqlquery #sqlbug #sqlproductionbug #sqldebugging #sqldatabase #sqlcodereview #sqlperformance #sqlreliability #sqlanalytics #sqldataintegrity #sqlengineering #sqlorderbyrand #sqlrandom #sqlsort ...

https://www.youtube.com/watch?v=2G3tRvhnyJM

Why does this SQL ORDER BY RAND melt the database? #sqlperformance

YouTube

How to Stop MySQL From Scanning With FIND_IN_SET

FIND_IN_SET bypasses indexes and burns CPU.

#mysql #findinset #performance #howto #schema #query

https://www.youtube.com/watch?v=qaLrnjZIcSE

How to Stop MySQL From Scanning With FIND_IN_SET #howto

YouTube

Why does this SQL SUM return NULL for empty?

Why does this SQL SUM return NULL for empty result. The SQL code sums a column without COALESCE. In SQL SUM of zero rows returns NULL not zero. In SQL APIs this breaks calculations and causes NaN downstream.

#whatswrongwiththissqlquery #sqlbug #sqlproductionbug #sqldebugging #sqldatabase #sqlcodereview #sqlperformance #sqlreliability #sqlanalytics #sqldataintegrity #sqlengineering #sqlsum #sqlnull #sql...

https://www.youtube.com/watch?v=gG4KtBljZ-o

Why does this SQL SUM return NULL for empty? #sqlreliability

YouTube

How to Prevent Slow Query Log From Filling Your Disk

One bad query. Millions of log lines.

#mysql #slowquery #log #howto #production #monitoring

https://www.youtube.com/watch?v=rmbArOL0UYQ

How to Prevent Slow Query Log From Filling Your Disk #slowquery

YouTube

How to Stop AUTO_INCREMENT From Reusing After Restart

Recycled IDs can break your caching.

#mysql #autoincrement #reuse #howto #ids #gotcha

https://www.youtube.com/watch?v=AMm1JExqDbU

How to Stop AUTO_INCREMENT From Reusing After Restart #mysql

YouTube