SQLite is enough

preview_player
Показать описание
SQLite is enough.
You should not use MySQL or Postgres.
And you should definitely not use queues
or other fancy cloud services like that

## Here is why

Simplicity

Complexity is coming from everywhere,
and to keep ourselves sane,
we have to pursue simplicity.

At the end of the video
I'll show why SQLite is enough
Benchmarks and shit

## SQLite benefits

But first, isn't SQLite just a toy technology?
Not really

SQLite gives a fresh breath of air
It is the sleek database
It is a super duper relational database
but just a file.
There are no servers.
It is incomprehensible what this does to your flow.

Elegant things happen when you just have a file.

1. Setup and permissions
2. Staging environment
3. Wonderful little things like Metabase

# Why can you do this?

## Standard Traffic

46% of websites received 1,001-15,000 visitors
19.3% received 15,001-50,000 visitors
23.2% received 50,001-250,000 visitors
11% received 250,001-10 million visitors
Only 0.5% of websites received more than 10 million visitors per month

## Performance?

```
Insert 50,000 took 113.7 ms ([NOMUTEX, 1000, 8192, EXCLUSIVE, IMMEDIATE, OFF, TRUNCATE])
Insert 50,000 took 114.3 ms ([NOMUTEX, 1000, 8192, EXCLUSIVE, EXCLUSIVE, OFF, MEMORY])
Insert 50,000 took 114.3 ms ([NOMUTEX, 8000, 8192, EXCLUSIVE, IMMEDIATE, OFF, MEMORY])
Insert 50,000 took 114.8 ms ([NOMUTEX, 4000, 8192, EXCLUSIVE, IMMEDIATE, OFF, TRUNCATE])
Insert 50,000 took 115.0 ms ([NOMUTEX, 1000, 8192, NORMAL, IMMEDIATE, OFF, TRUNCATE])
Insert 50,000 took 115.1 ms ([NOMUTEX, 2000, 8192, EXCLUSIVE, IMMEDIATE, OFF, TRUNCATE])
Insert 50,000 took 115.5 ms ([NOMUTEX, 1000, 8192, NORMAL, IMMEDIATE, OFF, MEMORY])
Insert 50,000 took 116.0 ms ([NOMUTEX, 1000, 8192, NORMAL, EXCLUSIVE, OFF, TRUNCATE])
Insert 50,000 took 116.0 ms ([NOMUTEX, 4000, 8192, NORMAL, EXCLUSIVE, OFF, MEMORY])
Insert 50,000 took 116.2 ms ([NOMUTEX, 4000, 8192, EXCLUSIVE, IMMEDIATE, OFF, MEMORY])
...[snip]...
Insert 50,000 took 307.0 ms ([NOMUTEX, 1000, 8192, NORMAL, EXCLUSIVE, NORMAL, MEMORY])
Insert 50,000 took 316.3 ms ([FULLMUTEX, 1000, 1024, EXCLUSIVE, EXCLUSIVE, NORMAL, MEMORY])
Insert 50,000 took 335.3 ms ([FULLMUTEX, 2000, 4096, NORMAL, EXCLUSIVE, NORMAL, WAL])
Insert 50,000 took 348.9 ms ([NOMUTEX, 2000, 4096, NORMAL, IMMEDIATE, OFF, MEMORY])
Insert 50,000 took 351.4 ms ([NOMUTEX, 1000, 1024, NORMAL, IMMEDIATE, FULL, TRUNCATE])
Insert 50,000 took 355.1 ms ([FULLMUTEX, 2000, 1024, NORMAL, IMMEDIATE, NORMAL, TRUNCATE])
Insert 50,000 took 368.1 ms ([FULLMUTEX, 1000, 1024, NORMAL, EXCLUSIVE, FULL, MEMORY])
Insert 50,000 took 368.1 ms ([FULLMUTEX, 2000, 4096, NORMAL, EXCLUSIVE, NORMAL, MEMORY])
Insert 50,000 took 436.4 ms ([NOMUTEX, 1000, 1024, NORMAL, IMMEDIATE, FULL, WAL])
Insert 50,000 took 541.6 ms ([NOMUTEX, 1000, 4096, EXCLUSIVE, IMMEDIATE, FULL, MEMORY])
```

## How do you use SQLite
Don't forget to subscribe because one of the next video will be how to use SQLite in production

## Shorts MSG
Checkout the full video below.
Yes, SQLite is enough

----------------------------

Goleko is the best project management tool with innovative features such as:

1. Screen recording on tasks directly
2. Time management directly built-in
3. Smartboard and our activity app help you to see everything that is going on.

Besides that, Goleko is a swift, simple, and yet powerful project management tool.
Imagine all the complicated features but so simple even your coworker can understand them.

A generous free version helps you get started. Checkout it out

----------------------------
Рекомендации по теме
Комментарии
Автор

Lack of background sound is enough. I dont know why but it is probably the most annoying background noise ever. Small children screaming would possibly be worse. Maybe.

TheDa
Автор

I use SQLite by default. If a project needs a client + server structure, anticipates lots of concurrent writes, or requires more granular permissions, then I'd use Postgres – but they rarely do. SQLite is very, very capable, im a big proponent. Also, it is trivial to spin up an in-memory database with SQLite – great for lightening fast tests

nodidog
Автор

Didn't think about the staging environment, but you're 100% spot on

thomasborg
Автор

Filesystem metadata. If it's SQLite, the state can be LVM snap-shotted with the files with only seconds of downtime to perform a backup.

jameshickman
Автор

Bro, someone is whistling in the background music on this video 😅 It can make it hard to pay attention - atleast for me.

steffengroenandersen
Автор

Magnificent video - thanks for making it.

Imaginativeone_DF
Автор

There's a few caveats to the "just copy the file" argument, you do need to lock the database file using sqlite commands to take backups if it is in journaling mode. It's a bit less of an issue in WAL mode where you can have multiple readers, but you still can't just use cp if the database file is in use. You can use tools like litestream but then you are technically back to having a streaming replica setup although a simpler one.

Sqlite is really really nice when it is an option though. It makes testing a lot easier, and sharding between users or self-service/provisioning is absolutely trivial which is another major advantage imo. If you need a lot of databases sqlite is your friend.

BosonCollider
Автор

I agree SQLite is fast, but you also need replication if you don't want to be down when one server is down. There's BedrockDB which is distributed SQLite with same benefits, but it's replicated.

vanillaface
Автор

I honestly love the whistle lol. It adds a bit of 'fill' to the silence.

the_ace
Автор

How you handle multiple requests accessing the same db file?

_shahdhaval
Автор

Great video, will definitely give SQLite a try

RihV
Автор

are u planning to release the "config" video soon ?

Alex-zmww
Автор

Honest and clear man right here who could see through the drama.

dineshkumarramasamy
Автор

I think the advantage of copy and pasting your database is a little overrated. If you are setting up a pipeline to test and deliver your software, replicating databases between environments is abstracted away and automated. Automation is easier than copy and pasting files between environments. It’s more work to set up the first time, but then more reliable and hands off from then on.

nuvotion-live
Автор

The video is informative and good to see. One feedback - the background score is very distracting. Please change it or get rid of it.

earthling
Автор

How about difference between sqlite and, for example, postgres? There may be a lot of problems if you will be top 10% visited sites
But in general SQLite is great for pet-projects, startups etc.

YouTubePavlo
Автор

Great video, but pls next time - skip the whistle background sounds.

blueml
Автор

Just doing a copy-paste of a db is so underrated 😂

BrunoBernard-knvt
Автор

SQLite is the single most deployed and used database solution on the planet.

scotmcpherson
Автор

Wow so annoying, couldn't watch.

NeUrOmAnCeRAI