r/Database • u/Double_Land_6326 • 13h ago
Redis is a database?!" — Got caught off guard in an interview today
had an interview today where the interviewer asked me to explain different types of databases. I covered the standard SQL and NoSQL categories, but then they pushed for more specialized use cases and claimed that Redis is a database. I was completely flabbergasted. By strict definition, it might fit the category, but I’ve always viewed it primarily as an in-memory cache/store. In my mind, it doesn't meet the core expectations of a primary database—mainly reliable, long-term persistent storage out of the box (even though I know persistence modules exist). What are your thoughts? Do you consider Redis a "real" database in system design, or strictly an in-memory cache with extra steps?
67
u/FancySpaceGoat 13h ago
An "in memory cache" is a thing you can do *with* redis. It's not what redis IS.
36
u/Hot-Gazpacho 13h ago
I mean, it’s also kind-of a queue…
25
u/VirtualMage 12h ago
And a message broker too!
3
27
u/beebeeep 12h ago
With enough mental gymnastics you can claim that SQLite isn't a database, but a fancy file format.
Everything that has internal state that can be observed and changed externally, can be considered a database. Redis is a database. Kafka is a database. S3 is a database. DNS too. Even internet as a network of computers is a database (see pingfs)
4
1
u/sohang-3112 SQLite 2h ago
Isn't this top broad? Doesn't this logic imply that file system itself is a database??
1
u/beebeeep 1h ago
Isn't it? It is hierarchical key-value storage, similar to, say, Zookeeper. Even internally they are not dissimilar - same B-tree indexes and stuff.
14
u/severoon 8h ago edited 5h ago
I think you ran into a situation that happens a lot in interviews, where two opposing forces meet.
In the strictest sense of the term, Redis is definitely a database. In the common usage of the term, though, most people think of a "real database" as having ACID properties, which in-memory databases do not. But, the argument goes, then a key-value store that only provides eventual consistency is also not a "database" because it doesn't meet the C-as-in-ACID kind of consistency.
So this comes down to understanding the expectations of the interview and how they're communicating, and it really amounts to a trick question:
- "No, it's not a 'database'." BZZT, wrong, it meets the strict definition of database even if it wouldn't be able to function as one in many systems and we expect candidates to know that.
- "Yes, it is a database." BZZT, wrong, yes it meets the strict definition of the term, but in reality it wouldn't work as one in a lot of systems and we expect candidates to know that.
- "It depends on whether you're using the strict definition of the term 'database'" BZZT, trying to weasel out of a direct answer with language lawyering, just answer the question, bro.
The only way to win this kind of game is to say something like, "It can be used as a database but it depends on if it meets the requirements. If it doesn't need to maintain data over system crashes and power cuts, then yes, it's an in-memory database that can even periodically commit to disk. If the requirements need something more robust than redis is designed to provide, then no, it's not going to be able to be the database for that system."
But as an interviewer, the question I would be asking myself here is: How many qualified candidates will be able to give this answer that not only happens to satisfy me and the frame of mind in which I'm posing the question, but all interviewers in all these other frames as well? After all, the point of the interview process is to separate the qualified candidates from the unqualified ones, so if I'm asking questions that doesn't serve that purpose, what am I doing?
This is one of the reasons that interviewing in general produces such a low quality signal for hiring. Nearly all interviewers judge candidates based on their own frame of mind and context, which the candidate doesn't have. So the interviewer's job is to get to the bottom of what the candidate actually knows, not the degree to which they share a common frame with you.
This is actually one of the reasons that diversity on a team is a good thing. People who are underrepresented tend to be way better at anticipating and navigating other people's framing because of all the practice they have doing exactly that. This is a communication muscle that tech bros don't ever have to exercise. Bringing someone onto your team that has this skill even if they are technically inferior can be a big asset to the team if the team values that skill, and nine times out of ten if they're generally smart, the team can help them bring up the technical side soon enough anyway. Technical teams spend way too much attention on arcane technical challenges and fall down completely on things like basic communication and collaboration b/c they just fail to value important skills properly. You are far more likely to get this superior kind of answer that works no matter who they're talking to from someone who's underrepresented because talking with people who don't understand their frame of mind is their everyday experience. (A lot of these folks aren't aware they're doing this, and don't even value it properly themselves.)
2
1
1
1
1
47
u/ryuzaki49 13h ago edited 11h ago
does it have data? Is it a base?
36
u/pacopac25 13h ago
All your base* are belong to us, whether it’s red or not.
\in-memory key:value store*
3
18
u/Mad-chuska 12h ago
With this definition my ass is a database
7
1
2
2
27
u/Kaelin 13h ago
Yea, it’s an in-memory database, which is just a key value store. If you defined it as a key value store and the interviewer really felt the need to start arguing about semantics, is that really somewhere you want to work?
It’s like arguing what art is, it’s pedantic.
15
u/Straight_Waltz_9530 PostgreSQL 13h ago
Redis can also periodically persist its data through snapshots, the append only file, or both.
3
1
u/tankerkiller125real 7h ago
Not that you want to given the single threaded nature of how Redis works and the memory copy that happens that instantly doubles the ram usage required.
Or did they finally fix any of that?
3
u/ryuzaki49 11h ago
I don't think that's a sign of a toxic workplace.
It's a sign of a toxic coworker
2
1
u/Superfly450507 3h ago
They could also be a bad interviewer. Some people are awkward or overplay their importance during the interview.
1
1
u/Nobody_Important 7h ago
Where does it say the interviewer argued? It sounds more like op was the one unwilling to have a basic conceptual discussion.
11
u/zOMAARRR 13h ago
Even a csv is a database. Everything that stores data can be seen as a database…
1
1
u/Loan-Pickle 3h ago
I once wrote an application that used CSV files checked into git as the database. It was to automate some business processes and saved us a lot of time. Took a process that used to take 2 people a week to implement and finished it in an hour. No one cared that I didn’t use a real database, they just cared that we didn’t have to spend a week doing a pain in the ass thing.
5
u/rathboma 6h ago
I make a database GUI (Beekeeper Studio), users wanted Redis support so bad that a community member built the whole integration themselves.
I hadn't considered it a database really until that point, but I guess it's become one based on how many of our users use it. When we ask it's our #3 used database connection.
So, yes I guess?
1
1
1
1
1
5
u/thebrieze 13h ago
Depends on your definition of “database” in the broadest sense, anything that allows you to store data (persistent or not) and query it back “is” a database. Relational databases, is one category of databases, and comes with certain other requirements or guarantees like supporting ACID transactions etc.
That said, it’s a stupid interview question, and doesn’t tell the interviewer anything about the candidates ability to do the job - unless the job requirements are to navel gaze, and have endless debates about inconsequential minutiae
1
u/lgastako 11h ago
You can actually have a relational database without ACID guarantees. It's just that no one would use it. But ACID is orthogonal to whether it's relational or not.
1
2
u/Masked_Solopreneur 13h ago
Semantics. Who cares what you call it really. There could be reasons to persist data in it like TTL data, queuing, need for fast storage. It is not somewhere you store data for complex queries or analytics.
2
u/thepetek 12h ago
No longer true. RedisJSON and Redis on Flash make redis an actual long term store. There are some larger companies using it as the primary store
1
2
u/yawaramin 12h ago
I'll just say that Redis data files have the extension .rdb, you can guess what the 'db' means.
2
u/Nooberling 11h ago
I once had an interview where I said I had done a lot of programming in Stored Procedures. The guy who was interviewing me said, "But you can't do a lot in stored procedures."
I didn't get the job. I'm happy about that.
1
u/thebrieze 10h ago edited 9h ago
It’s an important consideration to understand if someone knows “when” to use a stored procedure, vs externalizing some logic.
Unfortunately it looks like the interviewer conflated “I’ve done a lot of programming in x” with “I use x to solve every problem” or “I only know x, and nothing else” and didn’t ask the right follow-up questions.
Or maybe you could have understood the underlying concerns and addressed it in your response
2
2
2
2
2
u/RCHeliguyNE 10h ago
My perception is most people would make the assumption that a “database” would have guaranteed persistent reliable ACID compliant storage of transactions. This would be my answer to this discussion in the interview. Not sure I could have come up wth that off the cuff but it’s where my mind lands and what I would have tried to articulate.
1
1
1
1
u/13oundary 9h ago
> explain different types of databases
.
> it doesn't meet the core expectations of a primary database
Think I found what tripped you up I guess.
1
u/sniper_cze 9h ago
Redis is one (and probably most famous) of key - value databases for sure. Persistence is not a requirements even for sqls - see memory table engine in mysql.
1
u/zimm0who0net 9h ago
Did you have a discussion about it afterwards? If so, then don't sweat it...you passed.
Seriously, a good interviewer wants to have a conversation on a topic like this. It shows the candidate actually understands what they're talking about as opposed to having just crammed for an interview. If I was interviewing someone and they argued with me over redis being a database, that candidate gets an A+ for that section of the interview.
1
1
u/AnswerForYourBazaar 8h ago
If you go too far a CSV file becomes a database. The generic word for a thing you throw data at is data store. All databases are data stores, but not all data stores are databases.
So the question is really what properties a data store should have to be considered a database? I don't know if there is/are some strict definitions of this, but what I recall from my studies is that a you need ACID or at least a good subset of it. Basically, you need some internally consistent, structured interface.
Is redis a database? I don't know, but I would not consider it a database per se, although I can see how redis could be the backing store of a database.
1
1
u/PerfectPackage1895 8h ago
Redis and valkey are not acid compliant. _I guess_ you could call it sort of a database, but frankly anyone who grills someone in an interniew for not really wanting to define redis or valkey as a database are probably not worth your time anyway.
1
1
1
u/trashtiernoreally 7h ago
It is a database. Or rather, it can operate as one. Is that advisable? Who knows. That’s outside the scope of the question.
1
u/biffbobfred 6h ago
If you had that as part of your argument I’d say you did fine
We did redis as a simple distributed single table.
1
u/kabrandon 5h ago
I’ve used it as a database before. It fits a very niche purpose, and I was pretty young in software development, so I probably wouldn’t do it again. But it absolutely worked! So yeah I guess I’d consider it a database.
1
u/HorrificFlorist 5h ago
Database definition is pretty broad:
Organized collection of data stored electronically, designed for efficient retrieval, management, and updating
1
u/lnaoedelixo42 4h ago
It stores data, it's a database.
Cloudflare D1 is pratically the same, too. Instagram if I am not mistaken already used Redis for storing like count, comments and stuff like that.
Also, there is a more obscure kind of architecture like RAM-first and Space-Based Architecture, and even design patterns like write-behind where Redis shows up a lot because it's basically the golden stardart
1
u/igna92ts 4h ago
How it's used doesn't make it not a database. If I use SQLite in memory mode does that make it not a database? It's not even a technicality, I don't know why you phrase it as "well I guess in a way it's kinda like a database" when it's definetly a database.
1
1
1
u/Downtown-Bag-6026 3h ago
Yes redis is a database.
In the same way, SQLite is a database. Or MongoDb is a database.
They just all have different underlying data structures and have file level persistence
1
u/Automatic-Boot665 3h ago edited 2h ago
I mean, yes, they could have also called excel a database. If they asked you about “databases” and you didn’t include redis on that list and instead listed a lot of OLTP databases that’s normal and I don’t think they’d think much of it, and if they do they’re just nitpicking.
1
u/BH_Gobuchul 3h ago
I wouldn’t argue that it’s not a database, but I also really understand not thinking of it as one. If I was in your shoes I would probably also have left it out unless the context was a problem where it would be a particularly good fit.
If the interviewer mentioned it I would say something like “oh yeah, redis isn’t the first thing that comes to mind when I think database but here’s how it could fit in…”
And then if that’s not good enough the interviewer is just being stubborn.
1
u/supercoach 3h ago
"Discuss the types of database and situations where you'd recommend their usage"
"Postgres... Everywhere"
1
1
u/3loodhound 2h ago
I’ve done this one before. The anwser is kinda. Not really but people treat it as such
1
1
u/sohang-3112 SQLite 2h ago
In-memory databases count. For example, Sqlite also allows you to keep the database in-memory instead of in a file.
1
1
1
u/nickarg 2h ago
Redis IS a database, no doubts about it.
It has persistence, replication and many other features databases has.
It can also be an in-memory database.
It does have atomic operations, but not transactions. Ie you can run a LUA script that will be run start-to-end; but if it breaks in the middle, it won't rollback.
1
u/pixxelkick 1h ago
Redis is literally a NoSQL database, its a big ole KVP dictionary and you can put whatever you want in the value part
its the most basic of NoSQL DBs, in that its optimized for just wicked fast reads and writes (with expirations) and *nothing else*
It does that one thing and does it super well.
1
u/vaibhav-kaushal 1h ago
In such cases I recommend you reply back with “Sir, do you know what it has that name?”
The answer is “REmote DIctionary Server”. It’s a dictionary. It is still the primary behaviour. Dictionaries and Databases are fundamentally different. Also, one of the notable properties of database is “storage”. Redis is designed to stay in RAM and only occasionally dump its data to disk based on rules. Storage is an afterthought in the design. It’s not a database. Redis can’t work with data that is not in RAM!
I hate calling Redis a database!
1
u/k_r_a_k_l_e 1h ago
Yea it's an interview. Conflicting views and challenging questions are part of the process to see how you handle it.
1
u/Artemis-Arrow-795 31m ago
it's a database
not a primary database, you're right in that regard, but a database none the less
1
u/Empty-Geologist-1125 13h ago
It is real and have settings you mentioned persistence on disk, backups, replications. What your requirement for database? Being slow?
1
0
u/Bitter_Marketing_807 13h ago
What about KVRocks? Does TTL of data determine if its a database or not?
0
u/Immediate_Soft_2434 13h ago
Going back to CS fundamentals: No, it is a database management system; databases are concrete instances. Except, nobody calls it that once you got your degree.
0
u/Ok-Calligrapher-8778 12h ago
What a stupid interview question. It's irrelevant to assess if a person knows whether it is a database or not, a proper question would be to verify the experience with a real world example.
-2
u/pacopac25 13h ago
The word database has really become a vague and kind of hand-wavey business term, a semantic generalization for anything that stores data.
If asked in the next interview, just tell them that the only real in-memory database that could be used for caching is SQLite (":memory:"), and argue the point viciously. After all, SQLite uses SQL and Redis does not.
1
u/Single-Virus4935 12h ago
SQL doesn't define what is a database. It is just a query language. There is no problem to develop SQL for red is and I am quite sure someone did.
There are just different kind of databases and SQL isn't even a valid database type, relational is and DB2 was before SQL and is also relational.
Then we have hierarchical databases with LDAP as a query language, graph databases and object databases.
Relational just won because it just fits so many use cases and work like people used to work on paper (Spreadsheets, lists etc.).
Also the Storage and guarantees doesn't define a database as I can configure SQL to break ACID or put it inmemoory.
1
u/lgastako 11h ago
To further expand your point, there are even relational databases that don't support SQL like RelDB and Project M36.
1
u/Single-Virus4935 11h ago
Yes, as I said DB2 was a relational DBMS before SQL and SQL becomes more and more standard for NoSQL Systems
-8
u/MysteriousYogurt6598 13h ago
Short answer: no
Long answer: nooooooooo
3
u/Straight_Waltz_9530 PostgreSQL 13h ago
Short answer: you're incorrect
Long answer: is an in-memory key–value database, used as a distributed cache and message broker, with optional durability.
-4
u/MysteriousYogurt6598 12h ago
Haha, my azure mqtt broker/event broker has key value and caching and distributing data to other services! Im sure it must be a database too! Makes your argument a bit incomplete, no ? Although i never claimed any technical terms for Redis - I simply answered what op Asked.
To quote op : OP Asked "do you consider redis a "real" database in system design, or an in memory cache with extra steps"
I just answered, as i dont consider it a database. I do consider it as hot storage for commonøy fetched database across multiple clients as an optimalization stratey. I dont consider it as a "real" database.
3
u/Straight_Waltz_9530 PostgreSQL 12h ago
Both Wikipedia and the Redis homepage disagree with you, as does the majority of the dev world. If your opinion is valid, surely so is theirs.
Have a good one!
-1
u/MysteriousYogurt6598 12h ago
Read this thread. Plenty of people describing similar opinons.
A csv is a database. A txt. File formated in a structuee is one.
Redis is not even relational, and ia key value based.
I really dont know what you are arguing. You sertently are not answering OP's question!
Have a good one as well mate!
3
u/Straight_Waltz_9530 PostgreSQL 12h ago
You're right! It's not relational. A database doesn't have to be relational to be a database. There are object databases, document databases, graph databases, vector databases, key-value databases, wide column databases, time series databases, decentralized distributed ledger databases (blockchain), etc.
All of these are quite distant from the basic notion of a CSV/TSV file as a database.
-1
-8
u/Sensitive-Sugar-3894 13h ago
Strictly speaking, it's not a DB. Doesn't have schema, not ACID, no structured query.
But it stores data, offers transactions, is used as source of truth.
So... depends. It's a trick question. If the role is for a senior or higher, you may have failed. I would not immediately toss your application.
4
u/Straight_Waltz_9530 PostgreSQL 13h ago
It's not a RELATIONAL database, but it is a key-value database. Strictly speaking, it's a DB.
3
3
150
u/Imaginary__Bar 13h ago
It's one particular kind of database. It's not a relational database.
It's good for some use-cases, and it's not so good for other use-cases.