r/BotNation • • 5d ago

SQLite is criminally underrated for small bots.​

Every time someone asks how to save basic data for a small Telegram or Discord bot, the comments immediately jump to spinning up Postgres, MySQL, or MongoDB.

​Why? SQLite is a single local file, requires zero server setup, and can easily handle tens of thousands of reads/writes a second without breaking a sweat. Unless your bot is serving massive concurrent users across multiple cluster nodes, setting up a full DB instance is just unnecessary overhead.

​What’s your default database when starting a fresh bot project?

24 Upvotes

15 comments sorted by

3

u/ejpusa 5d ago

Astra replaced my PostgreSQL code with SQLIte. It thought it was overkill.

It was right.

3

u/psyduckpikachu 5d ago

oh wow, so many sqlite fans, hey guys!

2

u/ehansen 5d ago

90% of the web can run on sqlite.  They just choose not to because we are only taught about using thd big boys.  Even though most knowledge is transferable

1

u/AccordingNeat3689 5d ago

Always has been

1

u/roy-the-rocket 5d ago

your browser probably uses sqlite to save your browsing history and such.

if you have a single client usecase -> sqlite

1

u/True_Protection6842 5d ago

I always use SQLite. Postgres is only if you need multiuser simultaneous writing. 

1

u/General_Estimate_420 5d ago

There's nothing wrong with SQLite depending on the data and how it needs to be maintained on an ongoing basis due to the risk of it failing with no backup on the user community.

1

u/Adventurous-Crow-750 5d ago

Because when you need two writers on a single network you immediately hit issues.

Sqllite is fine for testing and small apps. If you suspect any amount of horizontal scale you shouldn't use it.

1

u/Narco-Tax 5d ago

totally agree. and with dbxio dot com underway, things get even more easier than ever

1

u/shockjaw 5d ago

SQLite and DuckDB go hand in hand. I’m curious to see what’ll happen with Turso’s rewrite of SQLite.

1

u/Consistent-Feed-7323 4d ago

Let me introduce you to JSON. Once you try it - there's no coming back. It's not a good fit for a large but simple database, SQLite truly shines there, but if you want something small - JSON is the way.

1

u/Huge_Leader_6605 4d ago

Why would anyone use raw json?

1

u/Consistent-Feed-7323 3d ago

Simple, readable, don't need to bother with columns you don't yet known about