What NoSQL databases are actually good?

As I understand, MongoDB is not rly a good idea due to scaling reasons (maybe others idk) I asked an AI and it answered this, what do you think?
No description
68 Replies
Bored Student
Bored Studentโ€ข4mo ago
Filesystems
danyella
danyellaโ€ข4mo ago
What do you mean?
Neto
Netoโ€ข4mo ago
there are multiple nosql options document dbs (mongodb) graph (neo4j) kv store (dynamo) about why: sql is quite limited if you take a hash map to the extreme, you land close to dynamo and cassandra
danyella
danyellaโ€ข4mo ago
A hash map?
Neto
Netoโ€ข4mo ago
yes
const map = new Map<string, unknown>()
map.set("some", "value")
const map = new Map<string, unknown>()
map.set("some", "value")
where with sql you would have something like this
> query: "select * from users where name = 'danyella'"

> table: users
$ row1 => name does'nt match 'danyella'
$ row2 => name does'nt match 'danyella'
$ row3 => name does match 'danyella', return it
> query: "select * from users where name = 'danyella'"

> table: users
$ row1 => name does'nt match 'danyella'
$ row2 => name does'nt match 'danyella'
$ row3 => name does match 'danyella', return it
with kv store you would make something like this
# imaginary query language
> query: "get('users', 'danyella')"

> collection: users
$ calculate hash for key = 'danyella'
$ access theorical value from hash
$ return value if it does exist
# imaginary query language
> query: "get('users', 'danyella')"

> collection: users
$ calculate hash for key = 'danyella'
$ access theorical value from hash
$ return value if it does exist
danyella
danyellaโ€ข4mo ago
why "hash" map? interesting
Neto
Netoโ€ข4mo ago
unique values that can scattered around instead of a big big big machine with all values, you can have 10 smaller machines key = 'danyella' is on machine number 7, ask there
danyella
danyellaโ€ข4mo ago
you mean, instead of storing the values you store the hashes ?
Neto
Netoโ€ข4mo ago
keys
danyella
danyellaโ€ข4mo ago
I don't think I understand what the more you're explaining the less I understand I think- sry
Neto
Netoโ€ข4mo ago
one sec im creating a image
danyella
danyellaโ€ข4mo ago
okay
Neto
Netoโ€ข4mo ago
"sql"
No description
danyella
danyellaโ€ข4mo ago
what?
Neto
Netoโ€ข4mo ago
kv
No description
danyella
danyellaโ€ข4mo ago
I don't even understand how i'm supposed to read it ahh wait I think I understand
Neto
Netoโ€ข4mo ago
take your time
danyella
danyellaโ€ข4mo ago
You say with sql, you have to go through all the data before having the one you want? well the keys I remember the B-Tree thing or B+Tree? anyways
Neto
Netoโ€ข4mo ago
yep
danyella
danyellaโ€ข4mo ago
so that, while kv just finds what you're asking for?
Neto
Netoโ€ข4mo ago
yep
danyella
danyellaโ€ข4mo ago
okay, but how does it work? I kinda understand how some SQL DBs work simply but how do you "calculate" the place where the data is?
Neto
Netoโ€ข4mo ago
hash maps ๐Ÿ˜›
danyella
danyellaโ€ข4mo ago
yeah, but how are hash maps working then? well no I think I understand kinda but, how does kv knows where something is by its hash?
Neto
Netoโ€ข4mo ago
that is the magic sause ๐Ÿ˜›
danyella
danyellaโ€ข4mo ago
and what are the ingredients of that sauce then?
Neto
Netoโ€ข4mo ago
internal code
danyella
danyellaโ€ข4mo ago
ah so we don't know?
Neto
Netoโ€ข4mo ago
for a specific kv like dynamo no
danyella
danyellaโ€ข4mo ago
what are the benefits of doing such a great thing and not making it oss- ah yes, money
Neto
Netoโ€ข4mo ago
yep dynamo is crazy fast
danyella
danyellaโ€ข4mo ago
Are there any open source "KV"s then?
Neto
Netoโ€ข4mo ago
redis ๐Ÿ˜›
danyella
danyellaโ€ข4mo ago
It's not open source anymore you know that r?- it's "source-available" shit But anyways thank you But well if I don't use Ubuntu because Canonical works with Amazon I'm clearly not using that for my project haha And you talked about Dynamo AND Cassandra is it a KV too or something else?
Neto
Netoโ€ข4mo ago
DynamoDB is aws keyvalue database its key-key-value but who cares
Bored Student
Bored Studentโ€ข4mo ago
danyella
danyellaโ€ข4mo ago
Damn their site is ugly Well mostly the footer anyways sorry
Neto
Netoโ€ข4mo ago
if you think that kv is hard to understand kkv (both dynamo and cassandra) allows you to make compund keys
danyella
danyellaโ€ข4mo ago
Ahh it's one of the Redis replacer I've heard of it Not really now that I understand the principle Compound keys? What are those?
Neto
Netoโ€ข4mo ago
where with kv you have one key, with kkv you have multiple keys
danyella
danyellaโ€ข4mo ago
Like SQL? I mean in SQL you can have a bunch of unique/primary keys (it's a bad idea) for one table
Neto
Netoโ€ข4mo ago
# kv
get('users', 'danyella')
get('orders', 'danyella')
get('orders', 'danyella.ORD123') # or something

# kkv
get('users', ['danyella'])
get('orders', ['danyella']) # all danyella's orders
get('orders', ['danyela', 'ORD123']) # danyella's order with id ORD123
# kv
get('users', 'danyella')
get('orders', 'danyella')
get('orders', 'danyella.ORD123') # or something

# kkv
get('users', ['danyella'])
get('orders', ['danyella']) # all danyella's orders
get('orders', ['danyela', 'ORD123']) # danyella's order with id ORD123
danyella
danyellaโ€ข4mo ago
ahhh pretty cool
Neto
Netoโ€ข4mo ago
yep
danyella
danyellaโ€ข4mo ago
Wait, Cassandra is built by Apache? But they also have Spark SQL?
Neto
Netoโ€ข4mo ago
cassandra was created on facebook but apache develops it now
danyella
danyellaโ€ข4mo ago
I guess they have to work in both worlds ahhh okay
Neto
Netoโ€ข4mo ago
but people use sql still? for (k)kv stores you can't simply get all values
danyella
danyellaโ€ข4mo ago
Ahh so no
SELECT * ON `users`
SELECT * ON `users`
Neto
Netoโ€ข4mo ago
data integrity as well yep
danyella
danyellaโ€ข4mo ago
annoying ah
Neto
Netoโ€ข4mo ago
its the tradeoff for "instant access" where sql queries take as much time as is to compare each row, kv stores most time is taken calculating where the value will be o(n) and o(1)
danyella
danyellaโ€ข4mo ago
what? I was told that SQL queries are said to be more like o(log n)? when you use the primary key tho I think thanks the way they are stored, the B-Tree thing
Neto
Netoโ€ข4mo ago
o(something that is slower)
danyella
danyellaโ€ข4mo ago
lmao
Neto
Netoโ€ข4mo ago
๐Ÿคน
danyella
danyellaโ€ข4mo ago
that's a way to put it I mean, o(log n) can be smaller than o(1) with a tiny db (i'm joking
danyella
danyellaโ€ข4mo ago
Hey wait
No description
danyella
danyellaโ€ข4mo ago
That's looks like SQL (the language
Neto
Netoโ€ข4mo ago
its correct
danyella
danyellaโ€ข4mo ago
indeed
Neto
Netoโ€ข4mo ago
its called cql
danyella
danyellaโ€ข4mo ago
Ik ik I said that it looked like the KEYSPACE keyword doesn't exist in SQL for ex
danyella
danyellaโ€ข4mo ago
No description
danyella
danyellaโ€ข4mo ago
well at least not in MariaDB (i'm only familiar with MariaDB and SQLite
FleetAdmiralJakob ๐Ÿ—• ๐Ÿ—— ๐Ÿ—™
what is your problem and what do you want to solve? do you want something realtime? something with high read speeds? something with high write speeds? do you want something in which everything is abstracted or do you want to write everything yourself? for which languages do you need an orm or something similar? after the answers to all these questions we maybe can find the best db for your use case
danyella
danyellaโ€ข4mo ago
Well, it's simple, I wanna learn x) But at the moment I don't havee any special needs For the very small side projects I do Fast or slow who cares, it's only for me That's why I kinda like MongoDB anyways
FleetAdmiralJakob ๐Ÿ—• ๐Ÿ—— ๐Ÿ—™
Ok, then choose a db that looks like fun
Want results from more Discord servers?
Add your server