Questions tagged [database]
This tag is for general database questions. If you question is specific to SQL or NoSQL, use the corresponding tags instead.
2,163 questions
1
vote
2
answers
236
views
What is a good strategy to avoid creating duplicate profiles for many individuals in a database?
I'm designing an application that is going to receive tens to hundreds of thousands of requests. Users submit requests on behalf of Customers (which are singular persons). Each request will contain ...
6
votes
5
answers
3k
views
System Design for low latency reliable online chess game
I want to build a low-latency chess backend (something similar to live chess on chess.com or basically any other online real-time chess), but there are a couple of questions I am unable to get answers ...
3
votes
2
answers
433
views
Why do database protocols use fixed endianness instead of native server endianness?
Most database wire protocols mandate a specific byte order for multi-byte integers:
PostgreSQL: big-endian (network byte order)
MySQL: little-endian
MongoDB: little-endian (BSON format)
OracleDB: ...
1
vote
3
answers
295
views
How can I introduce migration scripts to a team that has stopped using them?
In my working experience, I am into a situation in which the team has stopped using migration scripts for setting up the db. The team is fast paced focusing on business upon a 1-year old startup.
...
1
vote
2
answers
140
views
Designing persistence guarantees in an ingestion pipeline with a non-customizable intermediary
I’m migrating a large volume of historical RRD data into a VictoriaMetrics cluster.
By design, vminsert buffers and asynchronously forwards data to vmstorage. This makes it unclear when data is ...
1
vote
3
answers
139
views
How should we design an IoT platform that handles dynamic device schemas and time-series ingestion at scale (100K writes/min)? [closed]
We’re a small dev team (3 full-stack web devs + 1 mobile dev) working on a B2B IoT monitoring platform for an industrial energy component manufacturer. Think: batteries, inverters, chargers. We have 3 ...
0
votes
1
answer
139
views
How can I scale an embedded Java DB to support multiple processes or nodes?
I’m using JetBrains Xodus—a transactional, append‑only embedded Java database—inside a single JVM process and it meets my performance needs there.
Now I need to:
Allow multiple JVM processes on the ...
0
votes
1
answer
151
views
Microservice Architecture Design
I want to create one service that reads data from two databases and passes it to the customer devices. Is this an overall bad design decision? I think that since it is only read-only, it should be ...
0
votes
2
answers
154
views
Designing a social media notification system, would a single table with JSON column be the correct approach for data?
I am trying to create a notification system similar to Instagram, for the lack of better comparasion.
The Goal:
Getting user notifications in a unify way, for easy unparsing and displaying to user.
...
0
votes
1
answer
131
views
Best Practice for Managing Payment Subscription Tier Status
I'm trying to understand the best way to approach how to manage and update a user’s payment subscription status in a web application. Let’s say you have a subscriptions table in a database that is ...
12
votes
4
answers
3k
views
Is the separation of a database process from the main backend process really "good practice"?
In our current architecture, we have a React frontend communicating with a Rust backend via REST calls. We are considering introducing a PostgreSQL database, and my colleague suggests that we should ...
4
votes
4
answers
320
views
how can CQRS improve performence when we have to duplicate the writes
I was reading about CQRS, and from what I understand, it separates reading from writing by using two databases: one for queries (reading) and another for commands (writing). However, I don’t quite get ...
0
votes
3
answers
312
views
Transaction management with one connection
We have a desktop application written in Java that communicates with a DB. We support Oracle and Postgres. For the purpose of this question, let's focus on Postgres
Our app uses one connection for all ...
21
votes
5
answers
4k
views
How manage inventory discrepancies due to measurement errors in warehouse management systems
I'm developing an enterprise-grade warehouse management application for a chemistry laboratory. A critical feature involves mixing multiple stock solutions to create new solutions based on predefined ...
2
votes
2
answers
464
views
Best design pattern to synchronize local and cloud databases?
Right now I have an edge device (resource constrained) which is processing, storing, and querying time series data using a Postgres DB.
When a data collection event has ended, a simple script on the ...
4
votes
7
answers
2k
views
Should there be one-to-one relationship between DAOs and tables?
Should there be a one-to-one relationship between DAOs and tables? For example, should only one DAO communicate with a given table?
Our data layer is kind of flawed, e.g. we have a MAN table that ...
2
votes
0
answers
100
views
Efficient FIFO Data Storage and Deletion for Sequential Data [closed]
I’m building a device that needs to store data sequentially, retrieve it in chunks using FIFO, and then delete it. My device uses the ESP32-S3, and I'm currently using an SQLite build. However, as the ...
2
votes
3
answers
118
views
Planning Dynamic Patient Charts with Version Control and Historical Accuracy - Temporal Versioning or JSON
I'm working on a project for our healthcare clinic's software and could use some guidance. For regulatory and historical purposes, patient charts need to remain as "static" records—...
6
votes
4
answers
722
views
Why is there (practically) no 6-byte integer in common usage?
In Postgres, it used to be quite common to use a 4-byte integer auto field for primary keys, until it started becomming somewhat common to run into the 2147483647 limit of 4-byte integers. Now, it's ...
2
votes
1
answer
1k
views
One and only one vs One in crow's foot notation
Am I using one and only one correctly? I have read so many articles online on differences between one and only one vs one and I'm still confused.
I.e.
a customer can exist with zero, 1 or many (...
17
votes
8
answers
4k
views
How do we distinguish between "not filled in" and "unknown" in our data store?
In our domain model "not filled in" and "unknown" are two different concepts. For example, time of death may be missing or, on the other hand, may be filled in as "unknown&...
6
votes
3
answers
3k
views
How to handle primary keys and UUIDs in a database
I've heard advice from several people about using UUIDs as ID in your database. For one this has the benefit of making your URLs unguessable. It also masks how many objects you have in the system. e.g....
0
votes
1
answer
119
views
Database structure for two-step registration flow
I'm trying to design a database for supporting a multi-step registration flow. The registration flow goes like this: the user logs in via OAuth (which creates a session and user), then they're asked ...
3
votes
4
answers
858
views
How much better is using quad trees than simple relational database for storing location data?
I want to store and find back driver location data in the standard design uber/lyft problem.
I was researching about possible system design. Several videos and tutorials usually describe storing ...
-3
votes
2
answers
187
views
How to properly choose between two equivalent implementations, and how to prove you picked the correct one? [closed]
Thinking about non functional requirements (the -ities) and other concerns, which approach would you choose and why? consider the two snippets
Direct Supabase Connection
import { useState, useEffect } ...
2
votes
3
answers
186
views
Entity/DAO for any combination of values?
You have a nice set of entities
but then someone decides to add one or two more stupid values that are used only in one place (or maybe, not so stupid but ones I would rather avoid)
Now, you have a ...
0
votes
1
answer
401
views
What is the purpose of setting an isolation level for an INSERT INTO statement?
I want to better understand how isolation levels work, and here is my current understanding:
Isolation levels determine how a transaction is isolated from concurrent transactions. They are typically ...
1
vote
2
answers
523
views
Is it worth it to use a NoSQL database only for high availability and fast reading, while already using Postgres?
We have several Postgres databases on one AWS RDS cluster (for budget reasons apparently), sharing the same resources, and my team wants to use a NoSQL database alongside it, and store data there from ...
-4
votes
1
answer
292
views
How to stop showing SQL queries of a web application in Browser's Inspect elements?
I have a web application written in express.js and php 8.2. Currently, anyone can right lick in chrome or edge chromium browser and go to inspect element>>network tab and click on data ...
0
votes
5
answers
280
views
Best practice to save based on last record
I have a Web API in C# that receives data from various clients, which needs to be saved to the database. Each client sends data approximately every 10 seconds. To save this data, I need to base it on ...
0
votes
2
answers
120
views
Service classes that only forward to DAO
I've seen service classes that do nothing except forwarding calls to DAO classes. E.g. userService.save(user) would simply call userDao.save(user)
I heard the argument that some day in the future, a ...
4
votes
3
answers
337
views
What is the difference between a key attribute store and a key value store?
Im running through a course on Cloud Academy - now known as QA - and it makes the statement that
Azure Table Storage is a "Key/attribute store" and Redis cached is a "Key value store&...
2
votes
1
answer
180
views
How to design sharing feature properly in DB?
My DB has three tables:
CREATE TABLE Users (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL
);
CREATE TABLE Categories (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
user_id INTEGER ...
0
votes
1
answer
217
views
How to handle data when source of truth is through API
I am making a webapp that deals with money movement. All the financial actions are done through an API. For example, right now I can create an account for a user, add funds to their account, transfer ...
-1
votes
2
answers
459
views
Text files vs. MySQL Performance for Large Dataset
I am currently making a system for users to generate flashcards for Languages.
This involves adding information such as the definition, pronunciation, and example sentences for a word.
So far, I have ...
1
vote
1
answer
148
views
Single-source data warehouse permissions management
We (Data Platform team) are reviewing how we configure and apply permissions against our data warehouse objects, and I'm curious what tools or custom systems you might be using for this.
For context ...
-2
votes
2
answers
227
views
When should I think about two databases (the first for reads, the second for writes) in CQRS?
I am not asking what are advantages of two databases - the first for reads and the second for writes. I am asking WHEN I should have two databases for reads and writes? Probably there is no simple ...
2
votes
1
answer
308
views
What is an optimal system design for tracking product views per user that is scalable?
I have a web application that contains products and users. There are 10,000+ products and 100,000+ users to give a sense of the scale that's required.
For some application specific reasons, I need to ...
0
votes
1
answer
225
views
Hash Indexes vs LSM trees with SSTables
I was reading Designing-Data Intensive Applications, and I am confused about the usage of LSM trees with SSTables.
The author talks about Hash Indexes and log files (written as segments which are ...
7
votes
5
answers
445
views
What can I do to get a message processor to slow down the rate of writes that it is making to a database?
We have this architecture:
queue -> message processor (horizontal scaling) -> RDBMS
Sometimes external systems dump 10k messages onto the queue and the message processor of course dutifully ...
-1
votes
2
answers
146
views
How to handle complex logic, avoiding recalculation for performance reasons?
let's say we're building an Ecommerce Marketplace.
We have Sellers and each Seller has Products.
We want to display a list of available Products across all Sellers to Buyers.
But, we only need to ...
0
votes
1
answer
104
views
Referencing objects created during seeding by ID
I'm building a software that allows users to extract analytics from a data source. A subset of data periodically is extracted from the data source and stored in a separate database for ease of access (...
2
votes
1
answer
914
views
Designing a flexible and comprehensive restaurant menu database schema?
I am working on developing a MySQL database schema for a restaurant menu system inspired by platforms like DoorDash, UberEats, and Yelp. My aim is to design a schema that is flexible and can handle ...
1
vote
2
answers
133
views
Dynamic web application hitting database on front page load to fetch profile image
Folks, I am in middle of writing a web application (Python/Flask) where home page has user profile image in the navbar which is coming from a database (blob), I am wondering if this is a good practice....
11
votes
8
answers
7k
views
What is the advantage of log file rotation based on file size?
I understand that log file rotation is changing the log file you used when (1) one gets big enough or (2) at EOD, but I'm not sure I understand the reason for (1). I have never had any issues with ...
1
vote
1
answer
238
views
Scaling Heavy Writes When Fetching Data From External API
I have a service that fetches financial data from an external APIs and parses and saves that data in a postgres DB. The data can be quite large in size, our containers have crashed quite a lot due to ...
2
votes
7
answers
477
views
Why does "a consistent, understandable interface" differentiates database from global states?
According to some answers of How are globals any different from a database? that explains how database is different from global state:
https://softwareengineering.stackexchange.com/a/319389
https://...
1
vote
1
answer
143
views
How do you build a high availability, horizontally scaling application [closed]
I've designed an application, but I've had problems with scaling. Initially, this application was a simple docker compose file, that ran on a decently powerful VM.
Containerization is great, but the ...
11
votes
5
answers
3k
views
Why split up data retrieved from a database into multiple endpoints, if we need ALL the data anyway?
I have a "Games" API which retrieves video game data from a large database.
The /games endpoint returns some very basic information about the game, such as the title, description, etc.
More ...
1
vote
3
answers
2k
views
What is the correct way to find the differences between 2 relational tables?
Typically the solution for comparing if 2 relational db tables (I am using AWS Athena) are equal is to do full outer join on all the columns but adding an extra column to each dataset that acts as a ...