- Designing the code around the database leads to cleaner designs than doing it the other way around
- Almost all columns should be NOT NULL
- EXPLAIN helps you understand what the database does under the hood
- Designing the code around the database leads to cleaner designs than doing it the other way around
- Almost all columns should be NOT NULL
- EXPLAIN helps you understand what the database does under the hood
EXPLAIN ANALYZE output is cryptic enough for beginners to get any meaningful information out of it. Your thoughts on where to get started as a frontend developer?
This is great advice
> Almost all columns should be NOT NULL
Can you give your reasons for this? I never really understood the point of null tbh
* You're storing multiple types of data in the same table (often paired with a column indicating type). Some types have nulls in a column, other types have non-nulls.
* You've created an arbitrary limit on the data. Ex: a books table with author1, author2, and author3 columns.
* You add complexity to your queries making them less maintainable. For instance, you might start injecting COALESCE, IS NOT NULL, empty string checks, etc. all over the place.
* You need to be more careful with math. Ex: what is null + 10?
Null isn't universally bad, but it comes with issues you need to be aware of.