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. But you don't have to become a database specialist too, just a little bit more knowledge will. 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.

Latest Tips

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

View All

Sorted Tables for Faster Range-Scans

Storing rows pre-sorted in tables instead of by insertion order will boost the performance for large databases significantly.

June 22, 2022

UUIDs to prevent Enumeration Attacks

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

June 08, 2022

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.

May 25, 2022

ORDER BY with nullable columns

When ordering a nullable column the NULL values are sorted in a database-specific order. But the sorting can be changed to an application-specific ordering.

May 11, 2022

Descending Indexes

Changing the sorting direction for multi-column mixed-ordering indexes increases a query's performance by skipping the sorting operation.

May 04, 2022