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โ€ข6mo ago
Filesystems
danyella
danyellaOPโ€ข6mo ago
What do you mean?
Neto
Netoโ€ข6mo 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
danyellaOPโ€ข6mo ago
A hash map?
Neto
Netoโ€ข6mo 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
danyellaOPโ€ข6mo ago
why "hash" map? interesting
Neto
Netoโ€ข6mo 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
danyellaOPโ€ข6mo ago
you mean, instead of storing the values you store the hashes ?
Neto
Netoโ€ข6mo ago
keys
danyella
danyellaOPโ€ข6mo ago
I don't think I understand what the more you're explaining the less I understand I think- sry
Neto
Netoโ€ข6mo ago
one sec im creating a image
danyella
danyellaOPโ€ข6mo ago
okay
Neto
Netoโ€ข6mo ago
"sql"
No description
danyella
danyellaOPโ€ข6mo ago
what?
Neto
Netoโ€ข6mo ago
kv
No description
danyella
danyellaOPโ€ข6mo ago
I don't even understand how i'm supposed to read it ahh wait I think I understand
Neto
Netoโ€ข6mo ago
take your time
danyella
danyellaOPโ€ข6mo 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โ€ข6mo ago
yep
danyella
danyellaOPโ€ข6mo ago
so that, while kv just finds what you're asking for?
Neto
Netoโ€ข6mo ago
yep
danyella
danyellaOPโ€ข6mo 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โ€ข6mo ago
hash maps ๐Ÿ˜›
danyella
danyellaOPโ€ข6mo 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โ€ข6mo ago
that is the magic sause ๐Ÿ˜›
danyella
danyellaOPโ€ข6mo ago
and what are the ingredients of that sauce then?
Neto
Netoโ€ข6mo ago
internal code
danyella
danyellaOPโ€ข6mo ago
ah so we don't know?
Neto
Netoโ€ข6mo ago
for a specific kv like dynamo no
danyella
danyellaOPโ€ข6mo ago
what are the benefits of doing such a great thing and not making it oss- ah yes, money
Neto
Netoโ€ข6mo ago
yep dynamo is crazy fast
danyella
danyellaOPโ€ข6mo ago
Are there any open source "KV"s then?
Neto
Netoโ€ข6mo ago
redis ๐Ÿ˜›
danyella
danyellaOPโ€ข6mo 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โ€ข6mo ago
DynamoDB is aws keyvalue database its key-key-value but who cares
Bored Student
Bored Studentโ€ข6mo ago
danyella
danyellaOPโ€ข6mo ago
Damn their site is ugly Well mostly the footer anyways sorry
Neto
Netoโ€ข6mo ago
if you think that kv is hard to understand kkv (both dynamo and cassandra) allows you to make compund keys
danyella
danyellaOPโ€ข6mo 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โ€ข6mo ago
where with kv you have one key, with kkv you have multiple keys
danyella
danyellaOPโ€ข6mo 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โ€ข6mo 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
danyellaOPโ€ข6mo ago
ahhh pretty cool
Neto
Netoโ€ข6mo ago
yep
danyella
danyellaOPโ€ข6mo ago
Wait, Cassandra is built by Apache? But they also have Spark SQL?
Neto
Netoโ€ข6mo ago
cassandra was created on facebook but apache develops it now
danyella
danyellaOPโ€ข6mo ago
I guess they have to work in both worlds ahhh okay
Neto
Netoโ€ข6mo ago
but people use sql still? for (k)kv stores you can't simply get all values
danyella
danyellaOPโ€ข6mo ago
Ahh so no
SELECT * ON `users`
SELECT * ON `users`
Neto
Netoโ€ข6mo ago
data integrity as well yep
danyella
danyellaOPโ€ข6mo ago
annoying ah
Neto
Netoโ€ข6mo 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
danyellaOPโ€ข6mo 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โ€ข6mo ago
o(something that is slower)
danyella
danyellaOPโ€ข6mo ago
lmao
Neto
Netoโ€ข6mo ago
๐Ÿคน
danyella
danyellaOPโ€ข6mo 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
danyellaOPโ€ข6mo ago
Hey wait
No description
danyella
danyellaOPโ€ข6mo ago
That's looks like SQL (the language
Neto
Netoโ€ข6mo ago
its correct
danyella
danyellaOPโ€ข6mo ago
indeed
Neto
Netoโ€ข6mo ago
its called cql
danyella
danyellaOPโ€ข6mo ago
Ik ik I said that it looked like the KEYSPACE keyword doesn't exist in SQL for ex
danyella
danyellaOPโ€ข6mo ago
No description
danyella
danyellaOPโ€ข6mo 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
danyellaOPโ€ข6mo 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