Live data from Hacker News

Why I love databases

medium.com

31–40 of 172 posts

Re: Why I love databases

#31
post #13

Earlier quoted context omitted.

>you can say, everything inside a computer is about representing data hence: "The study of databases intersects almost every topic in computer science"

I just claimed this point of view is useless, so you can't just pick it up as if I agreed. Furthermore data representation in that broad sense is more related to data structures, not databases. Really, we all know what a database is. It is something very different from, say, a block cipher.

You claimed that point of view was useless, but you didn't argue why it was useless. My point of view is that none of "AI/Machine Learning/Computer Vision, Computer Graphics, Numerics/Simulation, Robotics, Bioinformatics, Computer Architecture or Cryptography" can be implemented (or even well conceptualized) without figuring out how they are to store, retrieve, encode, efficiently memoize, guarantee consistency or atomicity, or apply bulk transformations to their data.

It's silly to dispute that databases touch all areas of computing by simply declaring that databases touching all areas of computing is meaningless, because it's obvious that databases would touch all areas of computing, because computers are data storage, retrieval, and processing devices.

Maybe you're restricting your definition to RDMS (while mentally drawing some arbitrary sharp distinction between data structures and databases.)

>Really, we all know what a database is.

This is simply a declaration. If you know what a database is, define it, then make your case about what areas of computing that it is irrelevant to. Argument by common sense is empty.

Re: Why I love databases

#32
I'm glad he loves databases, databases have been the bane of my existence.

However, the torment they have given me has also lead to a similar fascination - and now I'm writing my own database! So I've become very familiar with the topics he writes on, and they are very good points for anybody interested in the subject.

Why would I write my own database? Because databases are hard, and I am determined to make them easy (even if that means me sacrificing years of my life into doing all this crazy research). Check out http://github.com/amark/gun !

- CAP Theorem, he is correct, P cannot be sacrificed. GUN is AP with eventual consistency. The beauty of this, though, is that you can always build strong consistency out of eventual consistency (it just requires knowing X amount of peers in advance, and doing a trivial lock until you've heard back from all of them - in fact, I do this in one of the example apps) but you can never go from strong consistency down to an eventually consistent system.

- Distributed Systems, this is incredibly incredibly important. I cannot repeat this enough times, there should be no "master" or "single source of truth" in any database. If there is, you're going to have a nightmare of a time being woken up at 3am to fix it when it crashes (my personal experience with other databases). Why? Because single points of failures will fail, centralized systems suck. Solution: Distribute and Decentralize! We make this easy for you.

- Correctness vs Efficiency, as he says, Paxos is difficult - all of them, Raft, Quorum, leader election, etc. DO NOT USE THEM unless you are Google, Amazon, Walmart, or what not. Even then, do not use them. Instead, I've solved this challenging problem by developing a new Conflict Resolution system that (very poorly) can be summarized as Vector Clocks + Timestamps, you get the advantages of both without either of their weaknesses. What his means is that data integrity is guaranteed because every machine is using a deterministic algorithm, without any extra gossip between machines. Let me repeat, you'll get the same result on every machine, eventually consistent, without any multi-machine coordination. This means every peer is a master, and that is awesome, even if you are running it on an ephemeral server/cloud - completely resilient to failures, terminations, restarts, and reboots.

- Empowering the App. Yes. Databases should serve you, not the other way around. Answers to his questions about abstractions are at http://github.com/amark/gun .

- Operational Challenges. This is where I diverge from him. If something seems wrong, like things suddenly becoming slow, you can easily just restart it without any damage/harm/failure occurring. And then you can look through your logs, taking your time, to see what went wrong.

- Basic Building Blocks. Because GUN is a graph database, you get key-value like access, as well as documents and relational styles. That is because mathematically graphs are the superset of relational algebra and hierarchy trees.

Happy to answer any questions!

Re: Why I love databases

#33
post #17

Earlier quoted context omitted.

Ok, assuming write-only means what I think it does, what is the point in a write only database? /dev/null/ is write only.

Append-only means that every fact is timestamped and nothing is ever thrown away. (Actually, Datomic provides excision, because some regulatory use cases require it, but it's a "black magic" feature.) The idea is that you should never use UPDATE or DELETE, unless it's a hard requirement or a well-studied optimization. The fact that it's 58 degrees today doesn't invalidate the fact that it was 45 degrees yesterday. Ne…

I've actually recently been thinking of extending this logic to my Anki geography deck. Populations change, but population at some specific point in time shouldn't.

Re: Why I love databases

#34
post #28

I hate databases. People tend to have way too much faith in them (or their surrounding marketing), and thus make poor database choices that don't actually fit the shape of their data. Persistence is fundamentally the programmer's responsibility; a magic box behind a socket can't design it for you. Most applications I've seen wouldn't even need a database, but apparently a lot of programmers are conditioned into belie…

Hmm. You are not thinking in business terms.

You run a software house: do you want your developers reinventing data storage on each application? Or using a fairly decent data storage that is RDBMS.

Most of the time RDBMS is a very good choice. Think about the tooling, support, hiring knowledgeable people etc. Lets face it RDBMS are good at the very small (single table, replacing a text file) up to the very large.

In the RDBMS/SQL world you have everything from sqllite to save as a single file, to Oracle for your Enterprise app.

Re: Why I love databases

#35
post #22

What I find both fascinating and scary about databases is how to choose between the wide variety of databases without understanding exactly how they work? And it doesn't help that there are new databases springing up all the time. Is there a way for application developers to understand these databases quickly without spending weeks working with them?

Use a "NoSQL" database when you have very large amounts of data (so you need 1000s of separate disks) or large volumes of queries (so you need a 1000s of separate servers). Otherwise MySQL, SQL Server, Oracle etc. is probably fine.

NoSQL has an learning and 'new technology' overhead that isn't worth paying unless the pain of using traditional databases is too high.

Don't forget SQLLite too - nice for the very small applications.

Re: Why I love databases

#36

Nice article. I love databases too for similar reasons but, as someone that designs database engines, some of the technical points are off the mark. I never really stop learning in this area, the technical range is incredibly deep and nuanced. Some of the points that caught my eye as being quite off: - Contrary to footnote 2, modern database designs bypass the OS file system cache and schedule their own I/O. This has…

by bitmap-structured you mean bitmap indexes?

any opensource db that schedule their own io? I guess postgresql, innodb?

what is your opinion on tokudb fractal-trees ?

Re: Why I love databases

#37

Nice article. I love databases too for similar reasons but, as someone that designs database engines, some of the technical points are off the mark. I never really stop learning in this area, the technical range is incredibly deep and nuanced. Some of the points that caught my eye as being quite off: - Contrary to footnote 2, modern database designs bypass the OS file system cache and schedule their own I/O. This has…

Doesn't Postgres rely on OS caching? Would you say it's missing out on large performance gains based on that?

Re: Why I love databases

#38
post #28

I hate databases. People tend to have way too much faith in them (or their surrounding marketing), and thus make poor database choices that don't actually fit the shape of their data. Persistence is fundamentally the programmer's responsibility; a magic box behind a socket can't design it for you. Most applications I've seen wouldn't even need a database, but apparently a lot of programmers are conditioned into belie…

Hmm. You are not thinking in business terms. You run a software house: do you want your developers reinventing data storage on each application? Or using a fairly decent data storage that is RDBMS. Most of the time RDBMS is a very good choice. Think about the tooling, support, hiring knowledgeable people etc. Lets face it RDBMS are good at the very small (single table, replacing a text file) up to the very large. In…

Most of the time a plain text file is good enough. Databases are overrated.

Re: Why I love databases

#39

Nice article. I love databases too for similar reasons but, as someone that designs database engines, some of the technical points are off the mark. I never really stop learning in this area, the technical range is incredibly deep and nuanced. Some of the points that caught my eye as being quite off: - Contrary to footnote 2, modern database designs bypass the OS file system cache and schedule their own I/O. This has…

Doesn't Postgres rely on OS caching? Would you say it's missing out on large performance gains based on that?

Postgresql also uses Shared Buffer Cache which seems to be what he's talking about ?

Re: Why I love databases

#40

Nice article. I love databases too for similar reasons but, as someone that designs database engines, some of the technical points are off the mark. I never really stop learning in this area, the technical range is incredibly deep and nuanced. Some of the points that caught my eye as being quite off: - Contrary to footnote 2, modern database designs bypass the OS file system cache and schedule their own I/O. This has…

Doesn't Postgres rely on OS caching? Would you say it's missing out on large performance gains based on that?

I believe that active data is stored twice (once in the Postgres buffer pool, and once in the FS cache). This is not ideal, because it is not making optimal use of RAM. To minimize this effect, PG recommends a relatively small buffer pool, which is not great if you believe the DB can do a better job than a generic OS.

I think this is quite fixable as well (I think I've even fixed it myself once) - just use O_DIRECT. Any PG maintainers able to tell me if PG still "double-buffers" and whether this patch would be useful if I could recreate it?

Post reply on HN