More Knowledge. Less Magic.

SQL is not Complex

A better understanding of SQL changes the database black box perception to a time saver reducing development effort.

👋 Hi, I am Tobias Petry.

I am database specialist helping developers solve their database problems. Many developers still treat databases and SQL as a black box: You write a query with a lot of trial and error, and hopefully the database returns the expected results. The implications of the query's properties or processing in the database are unknown to you. And because of the simple handling of MySQL, MariaDB, PostgreSQL and others, this basic knowledge has always been sufficient!

However you are missing out on many useful features! Some of the operations you have implemented in your application's code could have been done by the database and saved a lot of development time. And when your database has performance problems, expert knowledge is needed. However you don't have to become an expert, knowing a little more will make a big difference. And for this purpose this repository of knowledge has been created, check out all the information and learn anytime you may want to.

The Missing Book To Understand Indexes

Learn to create indexes for your slow queries by studying complicated database internals following simple principles.

View Book

Most-Loved Tips

Bite-sized database tips you can use in your application in a minute.

View All

For each loops with LATERAL Joins

A join can normally only link two static result sets together, but with LATERAL joins an efficient for-each loop with dependent subqueries can be used.

UUIDs to prevent Enumeration Attacks

Most applications are vulnerable to scrapers because of incrementing IDs. Retrofitting a UUID columns will solve the issue.

Fill Gaps in Statistical Time Series Results

Statistical calculations on a timeframe may have gaps due to missing that can be filled easily directly in the query.

JSON schema validation

Schema-free JSON documents can be checked to comply with a defined to get a schema-full NoSQL JSON column.

Delete Duplicate Rows

Duplicate rows can be easily found and deleted with a single query including a selection of which ones to keep.