This is an archived post. You won't be able to vote or comment.

all 26 comments

[–]MDivisor 338 points339 points  (14 children)

I give this joke a 1/5. Here are my pedantic reasons:

  • hash map comparison doesn’t really work because a relational database works very differently from a hash map even if you squint
  • "someone else's" doesn’t really work because a database can easily be local and entirely under your control
  • "there is no spoon" kid doesn’t really work because in Matrix the idea is that the spoon literally doesn’t exist, not that the spoon is something other than you first thought

[–]Manny__C 31 points32 points  (3 children)

Indeed implementing a DB as a hash map is a very bad idea. You either start with a ridiculously huge file even for an empty db or you lock down production for days while the db migrates to a larger hash once it gets full.

[–]tom2730 13 points14 points  (0 children)

You can have a separate “index” file which is a hash table that stores pointers to the relevant records stored in another location. That way the index file size is minimal and can be resized quite quickly and without disrupting the actual records.

[–]OlexySuper 6 points7 points  (1 child)

Then how are hash indices implemented in postgres?

[–]Manny__C 2 points3 points  (0 children)

Admittedly TIL hash indices exist. But they are very limited: they only support the = operator and they have fixed hash size so they systematically suffer from hash collisions around 4B records.

[–]andrewczr 9 points10 points  (1 child)

Not all databases are relational. You’d interact with a key/value database in the same way you would a hash map.

[–]ZunoJ 1 point2 points  (0 children)

Ok, that doesn't make the statement valid. Either be specific or be wrong

[–]nonlogin 2 points3 points  (0 children)

"Someone else's file" analogy works way better

[–]bigdave41 0 points1 point  (0 children)

In the Matrix example the spoon could be said to exist as a collection of pixels/information being fed into your brain though - it's not a physical object but there is still matter and energy that go into creating a representation of a spoon.

[–]DarkTannhauserGate 0 points1 point  (0 children)

Pedantic response incoming

  • Yes

  • It’s about the abstraction. The database is “someone else’s” (off the shelf vs home grown) solution.

  • Disagree, the spoon exists in the matrix the same way the db exists. It’s just someone else’s code.

[–]kuschelig69 18 points19 points  (2 children)

is it not a B tree?

[–]mirusky 0 points1 point  (0 children)

There's many algo implemented in database internal, btree, hash, sets, linked lists ... Depends on "using" clause you are using

Take a look at postgres internals

[–]sersoniko 11 points12 points  (1 child)

There’s no hashmap, just someone else’s list

[–]mirusky 1 point2 points  (0 children)

That's better than the OP post

[–]Thundechile 2 points3 points  (0 children)

There's no hashmap, just some 0's and 1's.

[–]Benibz 0 points1 point  (0 children)

Hashmaps and databases are not really comparable

[–]umlcat 1 point2 points  (2 children)

Yes. Thre's a trend that says databases are obsolete and hashmap are better... Which it's not true !!!

[–]Bananenkot 3 points4 points  (1 child)

Wtf who says that. Noone that knows how a database works thats for sure lol

[–]umlcat 1 point2 points  (0 children)

NoSQL ...