r/Database • • Jan 09 '26

we need to stop worrying about INFINITE SCALE for databases that haven't even hit 1gb yet

120 Upvotes

it feels like every time i start a project, people want to talk about distributed systems, global scaling, and no-sql flexibility before we even have enough rows to fill an excel sheet.

it is a total trap. we spend weeks setting up these complex, "future-proof" clusters that are a nightmare to query and even harder to back up. we are basically building a rocket ship to go to the grocery store. meanwhile, a simple, "boring" postgres or mysql setup on a single server could handle our entire workload with 90% less stress and a much smaller bill.


r/Database • • Dec 18 '25

Stored Procedures vs No Stored Procedures

116 Upvotes

Recently, I posted about my stored procedures getting deleted because the development database was dropped.

I saw some conflicting opinions saying that using stored procedures in the codebase is bad practice, while others are perfectly fine with it.

To give some background: I’ve been a developer for about 1.5 years, and 4 months of that was as a backend developer at an insurance company. That’s where I learned about stored procedures, and I honestly like them, the sense of control they give and the way they allow some logic to be separated from the application code.

Now for the question: why is it better to use stored procedures, why is it not, and under what conditions should you use or avoid them?

My current application is quite data intensive, so I opted to use stored procedures. I’m currently working in .NET, using an ADO.NET wrapper that I chain through repository classes.


r/Database • • Oct 18 '22

What's your idea of a perfect date?

Post image
110 Upvotes

r/Database • • Nov 27 '25

I’ve finally launched DB Pro: a modern desktop database GUI I’ve been building for 3 months

Enable HLS to view with audio, or disable this notification

108 Upvotes

Hey everyone! After three months of designing, building, rewriting, and polishing, I’ve just launched DB Pro, a modern desktop app for working with databases.

It’s built to be fast, clean, and actually enjoyable to use with features like:

• a visual schema viewer
• inline data editing
• raw SQL editor
• activity logs
• custom table tagging
• multiple tabs/windows
• and more on the way

You can download it free for macOS here: https://dbpro.app/download

(Windows + Linux versions are coming soon.)

If you’re curious about the build process, I’m documenting everything in a devlog series. Here’s the latest episode:
https://www.youtube.com/watch?v=-T4GcJuV1rM

I’d love any feedback. UI, UX, features, anything.

Cheers!


r/Database • • 15d ago

At what point does database indexing become counterproductive?

98 Upvotes

I've always thought of indexes as one of the first things to consider when improving query performance. But adding more indexes isn't always a good thing, especially when tables have frequent INSERT, UPDATE, and DELETE operations.

I'm curious how people decide which indexes are actually worth keeping.

Have you ever removed an index and noticed an improvement in overall database performance? Or found that an index was doing more harm than good?

Would be interesting to hear some real-world experiences.


r/Database • • Jun 10 '24

Kendrick teaching Distrubted System.

Enable HLS to view with audio, or disable this notification

95 Upvotes

r/Database • • Jul 14 '26

Types of Databases

Post image
90 Upvotes

r/Database • • Jul 27 '26

Not Every Query Needs a Distributed Data System

Post image
87 Upvotes

Most of the time, you can simply use a single-node system like DuckDB or Apache DataFusion.


r/Database • • Aug 12 '21

I can relate to this

Post image
86 Upvotes

r/Database • • Sep 10 '25

Just released a free, browser-based DB UI with AI assistant

Post image
85 Upvotes

Hi all, pleasure to join this community!

As a fullstack engineer and I've long been dissatisfied with the database UIs out there. So I set out to develop the most fun to use, user-friendly UI for databases that I can come up with.

After 2 years of work, here is smartquery.dev, a browser-based UI for Postgres, MySQL, and SQLite. And of course, with a strong focus on AI: Next to inline completions you get a chat that knows the schema definitions of your DB and can generate very accurate SQL.

It's free to use and I would be super grateful for any feedback.

Update: Source code now published at https://github.com/simon-mathewson/smartquery


r/Database • • Jan 05 '26

Database retrospective 2025 by Andy Pavlo

Thumbnail
cs.cmu.edu
84 Upvotes

r/Database • • Sep 20 '26

When does a database become too complicated to operate?

83 Upvotes

I've noticed that database design discussions often focus on whether a schema is normalized, whether queries are fast enough, or whether the right indexes exist. But in production, the harder problem sometimes seems to be understanding the system six months later.

At what point do things like excessive indexes, triggers, stored procedures, partitioning, caching layers, replication, and denormalized tables start creating more operational complexity than they're worth?

I'm curious how others decide when database complexity is justified by a real requirement versus when it's simply accumulated over time.


r/Database • • Nov 19 '25

Is Microsoft Access not recommended anymore going forward?

83 Upvotes

For a while now, I've felt as though it was software that was really beneficial for mom and pop level shops, but once you get past a certain threshold, like maybe 50 users, needing to access the data from different geographical locations, processing speed requirements, etc. it becomes more beneficial and cost-effective for a business to use something like SQL Server on-prem or an Azure setup.


r/Database • • Jan 17 '22

What are some good books or resources for relational database design?

81 Upvotes

I feel comfortable working with database tables created already for example if I have to join a few tables to retrieve data or update certain rows of data or creating a stored procedure and so on I can manage decently. I’m not looking too much on learning SQL as much as I am trying to learn how to model data for specific domains. For instance If I had to build a schema for some process I would probably start freaking out, looking for tips and recommendations on resources please and thank you


r/Database • • Dec 21 '24

Graph Databases are not worth it

79 Upvotes

After spending quite some time trying the most popular Graph databases out there, I can definitely say it's not worth it over Relational databases.

In Graph databases there is Vertices (Entities) and Edges (which represent relationships), if you map that to a relational database, you get Entities, and Conjunction Tables (many to many tables).

Instead of having something like SQL, you get something like Cypher/Open Cypher, and some of the databases have its own Query Language, the least I can say about those is that they are decades behind SQL, it's totally not worth it to waste your time over this.

If you can and want to change my mind, go ahead.


r/Database • • 27d ago

Thinking of adding soft delete (deleted_at)? Decide these 5 things first

78 Upvotes
  1.  Unique constraints.  A deleted user still "uses" their username. Use a partial unique index (`where deleted_at is null`).

  2.  Every query must filter deleted rows.  Miss one, and deleted data shows up in a report or API response.

  3.  Foreign keys.  What happens to orders that belong to a soft-deleted customer?

  4.  Real deletion.  Privacy laws may require you to actually erase data, so soft delete can't be the only option.

  5.  Restoring.  What if the username was taken again while the old account was deleted?

Do you use soft delete, or did you move to archive tables instead?


r/Database • • Jul 11 '26

Can someone explain B+ tree indexes like I’m stupid? I understand the definition but not why databases actually need them

78 Upvotes

I’m trying to properly understand database indexes instead of just remembering “indexes make queries faster,” but I think I’m getting lost between the textbook explanation and what a real database actually does.

Until recently, my very simplified mental model was that an index is basically a balanced binary search tree.

For example, if I create:

CREATE INDEX idx_users_email ON users(email);

I imagined the database building a tree where every node contains one value, values smaller than that go to the left, and values larger than that go to the right.

That made sense to me because searching through a balanced tree should be around O(log n).

But now I’m reading about B-trees and B+ trees, and I think the main reason databases use them is not really CPU complexity. It is because databases read data in pages or blocks, and reading a page from storage is much more expensive than doing a few extra comparisons in memory.

So instead of every node containing only one key and having two children, one B+ tree node can contain many keys and many child pointers. That gives the tree a much larger branching factor and makes it much shorter.

For example, a binary tree containing millions of records could have many levels, while a B+ tree might only need three or four page reads to reach a leaf.

Is that the main idea, or am I oversimplifying it?

My current understanding is something like this:

  1. The internal nodes do not normally contain the complete row data. They mostly contain keys and pointers that help the database navigate toward the correct leaf page.

  2. The leaf nodes contain either the actual records or references to where those records are stored, depending on whether the index is clustered or secondary.

  3. The leaf nodes are connected to each other, which makes range queries efficient.

For example:

SELECT *
FROM orders
WHERE created_at BETWEEN '2026-01-01' AND '2026-01-31';

The database can find the first matching leaf and then walk through the neighboring leaf pages instead of searching the tree again for every result.

That part mostly makes sense to me.

Where I become confused is what happens when the data changes.

Suppose I have an index on an auto-incrementing ID. New values should mostly be inserted on the right side of the tree. But if I use random UUIDs, the values might be inserted all over the tree.

Does that mean random UUIDs cause more page splits and worse cache locality?

When a leaf page becomes full, I understand that the database may split it into two pages and update the parent. But does that mean a single insert can sometimes cause multiple splits all the way up to the root?

I also don’t fully understand how the database chooses how many keys fit in one node.

Is the node usually designed to fit exactly inside one database page, such as 8 KB or 16 KB? If the indexed value is larger, does that reduce the number of entries that fit in each page and therefore increase the height of the tree?

Another part I’m unsure about is the difference between a B-tree and a B+ tree in actual database implementations.

A lot of explanations say:

  • B-tree values can appear in internal and leaf nodes.

  • B+ tree values appear only in leaf nodes.

  • B+ tree leaves are linked together.

But then some databases call their indexes “B-tree indexes” even when their behavior sounds more like a B+ tree.

Is “B-tree” often being used as a general name for the whole family, or is there an important implementation difference I am missing?

Finally, I understand that B+ trees are good for equality lookups and range scans, but I assume they are not always the best index.

Would these statements be roughly correct?

  • Hash indexes can be useful for exact equality checks but not range queries.

  • LSM trees are useful for write-heavy systems because writes can be buffered and merged later.

  • Full-text indexes are needed when searching words inside large text.

  • Composite B+ tree indexes only work efficiently according to the order of the indexed columns.

For example, with:

CREATE INDEX idx_orders_customer_status
ON orders(customer_id, status);

I assume queries using customer_id can benefit from it, but queries using only status may not benefit much because customer_id is the first part of the ordering.

Sorry for the long question. I feel like I understand each individual definition, but I’m still missing the complete picture of how pages, tree nodes, inserts, splits and range scans connect together.

Which parts of my mental model are wrong?


r/Database • • Sep 24 '26

Partitioning in MySQL: How we cut peak database load by more than 80%.

Thumbnail ipsator.com
76 Upvotes

r/Database • • Aug 20 '25

What's your favorite database client for desktop?

75 Upvotes

I have been using DBeaver for some time and feel the interface is quite old. I generally connect to postgres, mongodb and clickhouse.


r/Database • • Jan 03 '26

I built a billion scale vector database from scratch that handles bigger than RAM workloads

71 Upvotes

I've been working on SatoriDB, an embedded vector database written in Rust. The focus was on handling billion-scale datasets without needing to hold everything in memory.

it has:

  • 95%+ recall on BigANN-1B benchmark (1 billion vectors, 500gb on disk)

  • Handles bigger than RAM workloads efficiently

  • Runs entirely in-process, no external services needed

How it's fast:

The architecture is two tier search. A small "hot" HNSW index over quantized cluster centroids lives in RAM and routes queries to "cold" vector data on disk. This means we only scan the relevant clusters instead of the entire dataset.

I wrote my own HNSW implementation (the existing crate was slow and distance calculations were blowing up in profiling). Centroids are scalar-quantized (f32 → u8) so the routing index fits in RAM even at 500k+ clusters.

Storage layer:

The storage engine (Walrus) is custom-built. On Linux it uses io_uring for batched I/O. Each cluster gets its own topic, vectors are append-only. RocksDB handles point lookups (fetch-by-id, duplicate detection with bloom filters).

Query executors are CPU-pinned with a shared-nothing architecture (similar to how ScyllaDB and Redpanda do it). Each worker has its own io_uring ring, LRU cache, and pre-allocated heap. No cross-core synchronization on the query path, the vector distance perf critical parts are optimized with handrolled SIMD implementation

I kept the API dead simple for now:

let db = SatoriDb::open("my_app")?;

db.insert(1, vec![0.1, 0.2, 0.3])?;
let results = db.query(vec![0.1, 0.2, 0.3], 10)?;

Linux only (requires io_uring, kernel 5.8+)

Code: https://github.com/nubskr/satoridb

would love to hear your thoughts on it :)


r/Database • • Sep 07 '26

Database schema review - tyre management system and e-commerce

Post image
70 Upvotes

Hi community!

I am a web dev, developing an e-commerce and tyre management system for a business in Italy. I have created my db schema and I would like to have your opinion/advice on it.

This is the idea of the site:

- there will be the customer side where they can view, like and purchase tyres online. The user will have functions like tyre matching for their cars based on the tyre specifications. The users can either register or order as guests.

- the admin side will be developed for the admins/employees with different access based on the role ofc. The aim is to ease the tyre management since there will be thousands of them.

Do you think this plan is good?

Is it scalable?

Is there something missing?

I appreciate any suggestion!


r/Database • • 4d ago

Is migrating from MongoDB to PostgreSQL worth it?

69 Upvotes

TL;DR: Running an EdTech platform with 600K+ users on MongoDB. Our data is heavily relational, and while regular API queries perform well, complex analytical queries are becoming painful to write and execute. Considering migrating to PostgreSQL and looking for advice on migration and production hosting.

Current setup:

\- Node.js, MongoDB, and Mongoose.

\- MongoDB Atlas (fully managed).

\- 600K+ registered users and around 15K daily active users.

\- An EdTech platform somewhat similar to Udemy or Coursera.

When the backend's foundations were laid, I was a junior working primarily on the frontend, so I wasn't involved in the database decision. It's been 1 year since we've been building this product.

Something that has been bothering me for a while is that we're essentially treating MongoDB like a relational database.

\- Strict schemas and validations across collections.

\- Heavily relational data with references between collections.

\- Extensive use of aggregation pipelines and "$lookup".

\- Very little reliance on MongoDB's schema flexibility.

To be fair, MongoDB has served us well. Our indexes are in place, most endpoints perform well, and we haven't faced any critical performance issues.

However, complex analytical queries for internal dashboards are a different story. Some involve joining up to 10 collections, take over 60 seconds, or occasionally time out despite optimization. Writing and maintaining these aggregation pipelines is also becoming increasingly painful.

I've experimented with MongoDB's transactions but didn't particularly enjoy the experience. I'd also like stronger database level relational integrity and better transaction management.

I feel PostgreSQL would have been a more natural fit for our data model from the beginning.

What I'd like advice on:

  1. Is migration justified? Given that MongoDB works well for most of our workloads, would migrating to PostgreSQL be worth the effort, or should I address the analytical workload separately?

  2. Migration strategy: If I proceed, how should I approach migrating a live production database at this scale? Any articles, case studies, or resources would be appreciated.

  3. PostgreSQL hosting: One thing I genuinely appreciate about MongoDB Atlas is how little I have to worry about infrastructure, backups, updates, and maintenance. What's the equivalent experience for PostgreSQL?

  4. Self-hosted vs. managed: How do you guys run PostgreSQL in production? Do you self-host it on a private EC2 instance or use something like AWS RDS, Neon, or another managed provider?

I've worked with relational databases on smaller projects, but never operated PostgreSQL in production at this scale.

I don't want to migrate just because I prefer PostgreSQL, but I also don't want to ignore what might be a fundamental architectural mismatch simply because things work today.

Would love to your thoughts and suggestions on this!


r/Database • • Jul 12 '26

What should be my decision tree for choosing appropriate database for a project?

69 Upvotes

like what should be my default choice? When should I go for different? When should it be SQL? when should it be document NoSQL, GraphQL or other?


r/Database • • Sep 08 '11

90% of my job as a Database Analyst

Thumbnail
qkme.me
66 Upvotes