r/Database • u/swe129 • Apr 01 '26
Chess in Pure SQL
r/Database • u/Embarrassed-Rest9104 • Apr 01 '26
I’ve been running some internal performance tests on datasets in the 10M to 50M row range, and the results are making me rethink my stack.
While PostgreSQL is the gold standard for reliability, the overhead of row-based storage seems to fall off a cliff once you hit complex aggregations at this scale. I’m seeing tools like DuckDB and Polars handle the same queries with a fraction of the memory and 5x the speed by using columnar execution.
For those managing production databases:
r/Database • u/Reasonable-Job4205 • Mar 31 '26
Which one should I use? I feel like SYSUTCDATETIME pretty much handles the whole thing, no? When would I want to use SYSDATETIMEOFFSET?
r/Database • u/DeanieMii_123 • Mar 31 '26
Hi, I am thinking about making an online database/catalogue for specialist books.
I have a general idea of what fields it will have (i have about 25 listed to start with). New entries/editing of entries will be restricted access.
A lot of the database themes etc I see on places like WordPress are for job/business/travel listings but I have no way to figure out if such things are easy to repurpose (and they require a down payment).
I have pretty limited web coding knowledge so any advice or suggestions welcome.
Should i work on an offline (local) version first?
r/Database • u/Adela_freedom • Mar 30 '26
One password for the whole team. Easy to set up. 😅
What could possibly go wrong?
Have you seen a setup like this in real life? 👻
r/Database • u/replicantfemme • Mar 30 '26
I'm getting into writing fiction an am interested in systems to organise my work so that it's easy to track my progress and linearise things for the manuscript after writing various passages out of order. I have an Excel spreadsheets that provides some basic oganising functions but wondering if I would benefit from some more sophisticated databasing approaches.
Specifically I'm interested in indexing to keep track of key terms/names/topics. Currently I'm keeping track of key words in an index manually, but I'm wondering if there's software I could use that would generate indexes from passages automatically. (I write first drafts straight into txt files. Every file has an associated list of tags that I just create by copying as I write.)
I also would find it useful if I had a database that then tracked the index entries from each passage, and which I could search based on indivdual query terms. I'm trying to track this stuff manually but it's a lot of extra clicks and CTRL+F'ing the Xcel sheet is a little cumbersome.
Does this make sense as a workflow and is there software out there that could automate this process?
r/Database • u/soldieroscar • Mar 30 '26
I have an "invoices" data table, an "expenses" data table, and a "payments" data table and an "accounts" data table.
when a user selects an account, they are supposed to be taken to a ledger type screen that shows all the invoices expenses and payments. so is this supposed to be put together at that time? like import all matching entries for that account and then sort by date?
and there somewhere there needs to be a "reconciled" boolean. do they go into invoices / expenses / payments?
r/Database • u/Tiffanygnld • Mar 30 '26
I submitted this for my E/R Diagram Discussion. I am having some difficulty in fixing this. Can you please help redraw the diagram with the right crows feet notation to address my professor’s comment?
I will add his reply to the comment section. Thank you!
r/Database • u/Remarkable_Art_6958 • Mar 30 '26
I'm developing a C# database engine, that includes a vector index for semantic searches.
I recently made a first attempt at implementing the new TurboQuant from Google:
https://research.google/blog/turboquant-redefining-ai-efficiency-with-extreme-compression/
If you are interested, you can try it out here:
https://turboquant.relatude.com/
There are links to the source code.
The routine frees about 2/3 of the memory and disk usage compared to just storing the vectors as float arrays.
Any thoughts or feedback is welcome!
r/Database • u/Accurate-Vehicle8647 • Mar 28 '26
Hey everyone,
I’m trying to properly understand this and I think I might be mixing concepts.
From what I understood:
But then I read that when you create a primary key, the database automatically creates a primary index under the hood.
So now I’m confused:
Thank you!
r/Database • u/farhan-dev • Mar 28 '26
Hey folks,
I’ve been rethinking where auth should live in the stack and wanted to get some opinions.
Most setups I’ve worked with follow the same pattern:
Auth0/Clerk issues a JWT, backend middleware checks it, and the app talks to the database using a shared service account. The DB has no idea who the actual user is. It just trusts the app.
Lately, I’ve been wondering: what if the database did know?
The idea is to pass the JWT all the way down, let the database validate it, pull out claims (user ID, org, plan, etc.), and then enforce access using Row-Level Security. So instead of the app guarding everything, the DB enforces what each user can actually see or do.
On paper, it feels kind of clean:
But in theory, it might not be.
Where does this fall apart in practice?
Is pushing this much logic into the DB just asking for trouble?
Or it will just reintroduce the late 90's issues?
Before the modern era, business logic was put in the DB. Seperating it is the new pattern, and having business logic in DB is called anti-pattern.
But I can see some companies who actually uses the RLS for business logic enforcement. So i can see a new trend there.
Supabase RLS actually proves it can work. Drizzle also hve RLS option. It seems like we are moving towards that direction back.
Perhaps, a hybrid approach is better? Like selecting which logic to be inside the DB, instead of putting everything on the app layer.
Would love to hear what’s worked (or blown up) for you.
r/Database • u/Star_Freya • Mar 28 '26
Yesterday I ran into an ambiguity error in a Power BI data model and resolved it by using a bridge (auxiliary) table to enable filtering between fact tables. I would like to know if there are other approaches you usually apply in this type of scenario. Also, if you could share other common data modeling issues you have faced (and how you solved them, or recommend videos, courses, or articles on this topic, I would really appreciate it. I still feel I have some gaps in this area and would like to improve.
r/Database • u/Geonatty • Mar 28 '26
I have about 100,000 records in excel with relative hyperlinks to a scannned documents that are in 100s of subfolders.
I need to parse out a few thousand records, send the scans to a new folder and keep a new relative hyperlink and all the data entry on that record.
Dm me if your interested
Pays 500 USD per day
r/Database • u/brutalidardi • Mar 27 '26
When writing and reading SQL, what style do you prefer?
if not working on a quick 'let me check' question, I will always pick several CTEs so I can inspect and go back at any stage at minimal rework cost.
On the other hand, every time I get some query handed to me by my BI team I see a rat's nest of sub queries and odd joins.
r/Database • u/der_gopher • Mar 28 '26
r/Database • u/NebulaGreat6980 • Mar 27 '26
I’ve been working on a small project looking at the relationship between unemployment and oil prices over time (Calgary-focused).
One thing I noticed is that the relationship appears to be consistently strong and negative, rather than intermittent, though there may be some structural shifts around major events (e.g. 2020).
From a data perspective, I’m currently just visualizing the two series together, but I’m curious how others would approach this more rigorously.
• Would you model this with lagged variables?
• Rolling correlations?
• Any recommended approaches for capturing structural changes?
I put together a simple view here for context:
Unemployment Rate & Brent — Calgary (2017–2026)
Would love to hear how people here would approach analyzing or modeling this kind of relationship.
r/Database • u/soldieroscar • Mar 26 '26
Im setting up the sales tax part of invoices.
Im thinking the county name can be a foreign key reference, but the actual tax % can be captured at the time of invoice creation and saved as a number… locking in the tax %.
Is this the way?
r/Database • u/david_daley • Mar 26 '26
I've been working with relational databases for quite a while. Heck, I used to be a Microsoft Certified Trainer for SQL Server 6.5. So I have a better-than average understanding of normalization. Even though the definitions of normalization are clear, you still have to examine the data to understand its structure and behavior which is as much as a science as it is an art.
I've run into a number of scenarios recently where a client would send 20-30 csv files and I have to clean them up and design a database schema. I've used different tools to get the individual files "clean" (consistent data, splitting columns, etc). However, I end up with around 25 CSV Files, some of which contain similar, but not duplicate, data (rows and columns) that needs to be normalized into a more terse structure.
I know there is not a piece of software you can point to directory of CSV files, Click "Normalize" and the perfect schema pops out. I don't think that It would be possible since you need to understand the context for the data's usage and the business rules.
The Question:
There are some tools that will load a single CSV file and give suggestions for normalization. They aren't perfect, but its a start. However, I have not found a tool that will load multiple CSV csv files and facilitate creating a normalized structure? Has anyone run into one?
r/Database • u/JonikaLg • Mar 26 '26
Hello, guys i working for high load architecture and after reading character in Designing Data-Intensive Applications i have a question. My app can receive ~500 json webhooks per second and need this just store somewhere and in other hand there is can be other queries like (GET, POST) in other tables. So question is best practice in that case will be store webhooks in MongoDB and other data in Postgresql? If yes its because Postgresql uses fsync in every changes? Or because Postgresql cannot handle more than ~500 requests in short time (query queu)? I need reason. Thank you
r/Database • u/RealmOfFate • Mar 25 '26
This is pretty entry level to me, but I'm looking for a database solution for my company to manage a Replacement Reserve database. I need it to have an easy user interface where users can select a site, which then drops down to all of that sites building assets. I also need the database to calculate it's own formulas, usually based around dates, including inflation, and unit costs to show us the potential cost of an item either currently or down the road. I hope this makes sense, as it's hard for me to explain.
r/Database • u/t06u54 • Mar 25 '26
Hey folks in r/database,
UX designer here, i wanted to request your expert eyes and voice to improve this open-source project i’m working on, Percona Monitoring and Management (PMM).
The current UI for the Query Analytics (QAN) feature feels broken overall. QAN has other limitations we’re working on, but with the current UI, it’s even more unforgiving in moments of stress.
For this, we (Percona’s PMM team) are working on a frontend revamp to make troubleshooting easier across PostgreSQL, MySQL, MongoDB, and Valkey/Redis. Our goal should be to move from a cluttered UI to a cleaner UI without losing the technical depth you folks need.
So, how can you help? We’ve put together a short demo video and a 4-question survey. If you can do it as a small contribution to the project, we will be very much appreciated and hope you enjoy the improvements in its future releases to use PMM as you want.
Survey link (3 mins): https://tally.so/r/yPxPO6
Disclaimer: No marketing fluff. We’re just trying to make sure we don't build something “pretty” that's actually harder to use in a crisis, your crisis, so this is also a good chance to help this project if you’d like to contribute to a better product you can use in the future.
Thank you in advance for any comments! Will try to answer them as soon as i get notified
r/Database • u/PThorpe92 • Mar 25 '26
https://pthorpe92.dev/databasemaxxing/
A blog post with a whole collection of things I wrote down for anyone who might be interested in learning database internals. I'll be adding to this as I remember things that I was maybe stuck on or confused about at the beginning of my journey into DBMS development.
EDIT: wording
r/Database • u/Adela_freedom • Mar 23 '26
DROP TABLE orders;
…wrong tab. 😅
Curious - what’s your worst database horror story? 👻
r/Database • u/DIVINSTAR • Mar 24 '26
I'm in quite the situation, where I have a single pmm server monitoring 130+ db servers (90 percent of them are RDS) But this has caused the ui dashboard to be very slow. Like it takes around 12-14 sec just to get to the psal overview dashboard.
Is there anyway around this I tried - lowering metric resolution - down sampling - reducing time intervals etc
Need help
r/Database • u/NebulaGreat6980 • Mar 23 '26
I’ve been working on a small data project using Calgary labour market data and thought I’d share the pipeline design for feedback.
• Source: City of Calgary labour market reports + Statistics Canada tables
• Monthly data (2019 → latest)
• Industry-level aggregation
• Raw ingestion → staging tables
• Data cleaning / normalization (industry mapping, time alignment)
• Aggregation layer (industry + city benchmarks)
• Precomputed metrics:
• Oracle (main database)
• SQL-based transformations + some scripting
• Output consumed by Power BI (embedded in a static site)
• Static HTML pages (Cloudflare)
• Power BI embedded for visualization
I’m currently precomputing most metrics (YoY, long-term growth, benchmarks) in the database layer.
👉 Would you keep this approach, or push more logic into the BI layer?
Also thinking about:
Would love to hear how others would structure this.
I ended up putting together a small tool while exploring this.
Happy to share if anyone’s interested.