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

Did you find this page helpful?