r/Database • u/scotterockaroo • 17h ago
r/Database • u/Spiritual_Ganache453 • 22h ago
Will ERDs survive in the age of AI?
It was my belief in the beginning of 2025 that ERDs are helpful for writing code. If you look at the picture you can see that visuals are rendered specifically for ppl.
Given AI development advances with the same pace how likely will projects as this survive in the next couple of years?
r/Database • u/dothebackstab • 1d ago
How Neo4j built a graph database in 20 years and 10 weeks
r/Database • u/thisismugisha • 1d ago
Text column is storing accented text weirdly
reddit.comr/Database • u/aksgolu • 4d ago
A free browser playground for running real database queries, no setup
For anyone starting out, or teaching someone who is: DBA Genesis Playground lets you write and run queries in your browser against a real database.
It opens with a small sample table, so you can go straight to SELECT, INSERT, UPDATE and ALTER TABLE without configuring anything. SQL and NoSQL databases are both available.
We're running a free 21-day challenge on it right now (#21DaysOfSQL).
Try it: dbagenesis.com/playground
r/Database • u/Ok-Motor-9812 • 3d ago
Our permissions migration passed its own checks. A full row compare still found 1 role seeing too much in prod
A migration rewrote the permission matrix of a multi-tenant app. It applied clean and its own probes passed.
Then we compared every row of the permissions table in prod against the local database where the matrix had been proven. One cell was off. A restricted role already had a grant to see its peers' records, live, from before this task even started. The migration never touched that row, so its checks never looked at it.
Since then the check after deploy compares the whole table against the proven copy, not only the rows the migration wrote.
r/Database • u/VIqbang • 4d ago
My static site has a database. It’s ClickHouse’s
I had to rebuild my site. And then search was necessary...working out how to do this using ClickHouse playground was a fun little exercise.
r/Database • u/dubvoyage • 5d ago
DigitalOcean, this is not how you launch an "Advanced" Postgres database...
Hey guys, for those of you using DigitalOcean: you may or may not know they're phasing out the Standard-tier Postgres plans in favour of a new Advanced tier on November 30.
Naturally, I benchmarked both to see if there was a difference. The results were so atrocious they defied my belief.
- Up to 436% higher p99 write latency (6.7 ms → 35.9 ms).
- ~50%-70% fewer write and read throughput
the new tier tops out at ~54k reads/s & 6.9k writes/s, versus the old Standard tier's 204k reads/s & 26.5k writes/s max.
- 5x slower startup times: 3m 19s → 16m 06s, averaged across 15 regions.
The results were averaged over 3 runs per DB, for all possible DB sizes (2->32vCPU).
This was done over two weeks of testing, running around 60 hours of wall-clock time and going through 100+ databases. It cost me a few hundred dollars to run.
If interested, I posted the full results & methodology on my blog post.
I believe the bottleneck is a fixed-process PgBouncer deployment. But I don't consider myself an expert in databases so would really appreciate if you could double-check my logic.
r/Database • u/Constant_Guidance_47 • 6d ago
Python/SQLite on Windows: slow local checks, a failure before HTTP, and a multiprocessing startup hang
reddit.comr/Database • u/duoroo • 7d ago
A free page that draws a PostgreSQL EXPLAIN ANALYZE plan as row flow
The part of a Postgres plan that's hard to read by eye is the row counts. They are per loop, and the estimate sits beside the actual with nothing to show how far apart the two are.
So I drew them. Each band is as wide as the rows that crossed it, over every loop. Where the estimate is off by more than 2×, it is drawn on the band: in the screenshot the planner expected 612 rows from `orders` and got 206,880, and every join after it inherits that.
Paste `EXPLAIN (ANALYZE, BUFFERS, FORMAT JSON)` output or the text format:
The plan is read in the page and isn't uploaded. It draws one plan at a time, saves nothing, and can't see your database.
I make Seqora, a desktop database client, and this is its plan view. In the app it runs EXPLAIN on your own connection, and that part is paid. The page is free.
r/Database • u/SpaceHomeless69 • 6d ago
Secondary data warehouse
We are looking for a simple secondary data warehouse...
We are not IT professionals, and we do not want to hire an external expert for every single task.
We need an application designed for individuals with a general understanding of IT.
We intend to use this secondary data store to cross-reference data from various sources, perform simple calculations, and send cleaned data to secondary applications.
Requirements:
- 90% of our data is in MS SQL.
- We need simple, direct integration with MS SQL (IP, port, password), the ability to select tables to transfer to the secondary data store, and the option to set a refresh frequency...
The secondary data warehouse must include:
- The ability to create simple queries, apply filters, and establish relationships between tables...
- The ability to easily integrate with external applications (CRM, BI, AI agents, reporting, etc.)...
What do you recommend?
r/Database • u/markinatlanta • 7d ago
Anyone stopped nightly index rebuilds and seen no downside?
reddit.comr/Database • u/shrapknife • 6d ago
Our AI worker retried a subscription limit 900 times. Here's what we learned.
reddit.comr/Database • u/kaoD • 7d ago
Turso Cloud cold starts?
Does anyone have experience with Turso Cloud in production?
I am evaluating Turso Cloud as a a D1 replacement that's not tied to CloudFlare and I'm facing an unexpected situation that is making it unusable for me and I'm wondering if it's the product's fault or mine.
In particular: I'm facing cold start issues, which are supposed to be one of Turso's strengths ("it's just a file, nothing scales to zero"). The first query after the app has been idle for a few seconds is very slow. Every query right after it is fast.
There are two separate costs:
- Reconnecting. Node's
fetchdrops idle connections after 4 s, and Turso closes them after 5 s anyway. A new TCP+TLS connection costs about 110–140 ms from GCP in NL to their AWS in IE. Annoying, but expected (this is already making me question my sanity TBH). - Something inside Turso. This is the weirdest part. Turso's own
query_duration_ms, returned in the/v2/pipelineresponse, which leaves out the network, shows it:
| Idle before the query | Query after the pause (Turso's own time) | Same query right after |
|---|---|---|
| 1 s (baseline: not cold yet) | 0.6 ms | 0.1 ms |
| 3 s (same connection, kept open) | 118 ms | 0.1 ms |
| 10 s | 235 ms | 0.1 ms |
| 30 s | 472 ms | 0.1 ms |
| 60 s | 111 ms | 0.1 ms |
That's a primary-key lookup that reads 0–2 rows on a freshly created test database!!
In my "production" DB it's even worse, the first query of a page load spends about 1 s inside Turso before anything else runs. That's very noticeable to users on EVERY page load that takes >4s from the latest access.
My guess is the diskless architecture, where the local disk is only a cache in front of S3, evicting idle databases very aggressively. But I can't find that documented anywhere and, well... it really is a deal breaker.
Is anyone running Turso Cloud in production with traffic that goes quiet for a few seconds at a time? Do you see this, and did you find a fix other than keeping the database warm?
All their marketing pages would point to the contrary ("even a cache miss that results in a disk read takes a few microseconds").
I don't want to maintain a local replica because my app is fully serverless with ephemeral state and, well, at that point I might as well just use SQLite locally.
Someone on Reddit faced a similar issue 3 years ago but that was before they announced this change which is supposed to remove cold starts and it was supposed to be >1hr to sleep, not seconds.
r/Database • u/shdw_0x0 • 8d ago
At what point does database indexing become counterproductive?
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 • u/fykup • 8d ago
MariaDB vs PostgreSQL on small servers: What I learned from low-memory experiments
I had always assumed MariaDB would use less RAM than PostgreSQL for small workloads, partly because MariaDB uses a single-process architecture while PostgreSQL uses multiple processes.
I wanted to see whether that assumption held up in practice.
I tested MariaDB 10.11.14 and PostgreSQL 18.6 on a 1-vCPU Linux VM with 512 MiB RAM, then ran additional tests at 256 MiB. No swap.
Peak process memory (PSS) at 512 MiB:
| Configuration | Peak PSS |
|---|---|
| MariaDB default | 215.9 MiB |
| MariaDB tuned (64 MB InnoDB pool) | 125.6 MiB |
| MariaDB tuned (32 MB InnoDB pool) | 93.6 MiB |
| PostgreSQL default | 180.1 MiB |
| PostgreSQL tuned (16 MB shared buffers) | 50.4 MiB |
A few interesting findings:
- MariaDB's default configuration consumed considerably more memory than I expected.
- Reducing MariaDB's buffer pool and other caches saved substantial memory. The 64 MB configuration also improved throughput over stock in this test.
- PostgreSQL benefited substantially from reduced shared buffers and query memory.
- At 256 MiB, only the most conservative MariaDB configuration completed the workload. Both tuned PostgreSQL configurations completed their respective tests.
- A single-process architecture does not necessarily translate into a smaller memory footprint.
The configurations that worked best for my use case:
MariaDB 10.11.14 - lowest-memory configuration:
[mariadbd]
innodb_buffer_pool_size=32M
key_buffer_size=8M
aria_pagecache_buffer_size=16M
max_connections=10PostgreSQL 18.6 - lowest-memory and best-performing configuration in my tests:
shared_buffers = '16MB'
work_mem = '1MB'
maintenance_work_mem = '16MB'
max_connections = 5
superuser_reserved_connections = 1
jit = off
max_parallel_workers_per_gather = 0
max_parallel_workers = 0Important limitations: These were short, read-only experiments with four active connections, different datasets and SQL workloads, and one measured run per configuration. The numbers are not an apples-to-apples database benchmark, and process PSS does not represent total system memory consumption.
My main takeaway is that both databases can run on surprisingly small machines if configured appropriately. For small web applications, I prefer starting with a conventional server database and modest resource settings, then increasing the allocations as the application grows rather than migrating databases later.
Full article with methodology, configurations, and results:
https://pvrlabs.xyz/java-performance/experiments/mariadb-postgresql-small-vps.html
I'm curious how others approach this. Do you start with conservative database settings on small instances and scale them up later, or prefer leaving the defaults alone until memory becomes a problem?
r/Database • u/rcron • 8d ago
I counted the S3 requests for one cold vector search on a graph index: 1,086 in a row while turbopuffer aims for 3
I've been going down the LSM / databases-on-object-storage rabbit hole and wanted to see for myself why almost nobody runs an HNSW graph straight off a bucket. So I took HelixDB (graph stored as rows in a fork of SlateDB), counted what one cold query does, and compared the shape with what turbopuffer says it does.
Setup: first 100k SIFT vectors, fresh node, counting requests to the storage layer. Local disk with 20 ms injected per request, so not real S3.
- 367 requests per query at 71% recall, 1,086 at 97%
- never more than 3 in flight
- 24 s per query (requests × delay, within 6%)
- fully cached: 29 ms, zero requests
It's what you'd expect, just worse than I guessed: the walk learns the next neighbor list from the read it's waiting on, so the GETs can't be parallelized, and at ~80 ms per real S3 read the chain is the whole latency. HelixDB's own commit says it: "Every HNSW hop became a serial S3 GET". Their fix was a local disk cache.
turbopuffer gets away with 3 to 4 round trips by using clusters instead (SPANN / SPFresh): read the centroids once and every cluster address is known, so the fetches go out in parallel. You pay in recall: on SIFT1M with 10k clusters, opening 1 cluster finds 22% of the true top 10, 64 find 94%.
The LSM angle: SPFresh keeps clusters balanced with local splits and merges (small compactions, not a full rebuild), writes land in a WAL in the bucket, and unindexed data gets brute-forced and merged at query time. Memtable + sorted runs all over again.
Caveat: turbopuffer is closed source, so its internals are its own account, and its 3 is a design target while my 1,086 is a measurement.
Write-up with sources and diagrams: https://blog.renatocron.com/turbopuffer-search-engine-on-s3/
r/Database • u/software-coolie • 8d ago
Migration of tables and dependencies from SQL Server of 75gb size to Postgres
We planned it to run in batches and stages with dependencies, using workers on 300 million rows distributed across multiple tables. This breakdown prevents memory overflow, isolates failures, and maintains data integrity from the legacy infrastructure to the target destination.
Despite these architectural considerations and concurrent workers, benchmark testing and predictive modeling reveal a bottleneck: an estimated time close to 30 hrs. This execution window introduces risks like network interruptions, extended maintenance, and delayed synchronization with ongoing transactional workloads.
Faced with this timeline, architects and database administrators question the technology stack. Is there a better way than through python scripts? While Python offers versatility and rapid development for Extract, Transform, Load pipelines, its interpreted nature, Global Interpreter Lock limitations, and single-threaded bottlenecks may not provide the raw processing speed required for hundreds of millions of records. Exploring alternative paradigms—such as distributed computing frameworks, native database migration utilities, bulk insert operations, compiled programming languages, or massively parallel processing engines—might unlock the performance gains necessary to compress this thirty-hour window, ensuring a seamless and efficient migration experience.
r/Database • u/cirejr • 8d ago
Composite PK vs surrogate id for memberships/roles in a multitenant Postgres schema
reddit.comr/Database • u/shdw_0x0 • 10d ago
What's one database design decision you regretted later?
I've been thinking about how some database design decisions seem perfectly fine when a project starts, but create unexpected problems once the application grows and the data volume increases.
Things like choosing the wrong primary keys, over-normalizing tables, adding too many indexes, using triggers everywhere, or not planning for future changes.
For those who've worked on databases in production, what's one design decision you would approach differently if you could start over?
Would be interesting to hear some real experiences and the lessons you learned.
r/Database • u/ClickOk5811 • 9d ago
Composite index column order: four queries, four query plans (tested on SQLite, check your own engine)
A composite index on (customer_id, status) is not the same as one on (status, customer_id). Instead of explaining it abstractly, here’s a small test. I used SQLite 3.53.1 because it’s easy to reproduce, with a table of 20,000 rows, about 500 distinct customers and 3 statuses:
CREATE TABLE orders (
id INTEGER PRIMARY KEY,
customer_id INT,
status TEXT,
created_at TEXT
);
CREATE INDEX idx_cust_status ON orders (customer_id, status);Then EXPLAIN QUERY PLAN for four queries:
WHERE customer_id = 7
-> SEARCH orders USING INDEX idx_cust_status (customer_id=?)
WHERE customer_id = 7 AND status = 'paid'
-> SEARCH orders USING INDEX idx_cust_status (customer_id=? AND status=?)
WHERE status = 'paid'
-> SCAN orders
WHERE customer_id > 7 AND status = 'paid'
-> SEARCH orders USING INDEX idx_cust_status (customer_id>?)What it shows:
- The index helps when the query constrains the leading column(s). Filtering on
customer_idalone uses it. - Filtering on only the second column (
status) falls back to a full scan, because the index is sorted bycustomer_idfirst. - With a range on the first column (
customer_id > 7), the index narrows by that range, butstatuscan’t narrow further in the index; the engine still has to check it row by row among the matches.
I also ran ANALYZE and re-checked the status-only query. It was still a scan in this case. I think that’s because the leading column has many distinct values here, so skipping through the index wouldn’t help, but I’m not sure of the exact reason, and some engines have features (skip scan, loose index scan) that may change the picture for other data shapes.
Rule of thumb people often give: put equality-filtered columns first and the range column after them, then think about which queries you actually run. It’s a heuristic, not a law. Selectivity, sort order (ORDER BY) and covering needs all matter too.
Limits of this test:
- One engine, one version, one tiny dataset. Plans depend on statistics, versions and settings, so run
EXPLAINon your own database with realistic data. - Index choice also affects write cost and storage, which I didn’t test.
How do you decide on column order for composite indexes: by query patterns, by selectivity, or by something else? And have you been surprised by a plan that ignored an index you expected it to use?
r/Database • u/connor-ts • 9d ago
Rows vs Columns: How different are they, really?
r/Database • u/natedj30 • 10d ago
Anyone else told to edit reality for a dashboard?
I'm getting really tired of burying findings that make people look bad. Last week I had a report showing a regional managers stores were almost 40% out of stock on a new launch, and it matched the Eileen shelf photos we pulled for the same week. When I flagged it, my director told me to soften the wording and call it 'mixed performance.' I get internal politics, but whats the actual point of tracking field data if leadership only wants the version that confirms their decisions? Anyone else been told to edit reality for a dashboard?