Live data from Hacker News

Why I love databases

medium.com

111–120 of 172 posts

Re: Why I love databases

#111
post #95
post #91

Earlier quoted context omitted.

The language issue you raise is in part solved by C# and Entity framework. Because of the lazy way it works you can define a single select over a table, then apply extension methods, joins etc.. over the return of this select and you end up with a highly reusable clean easily tested data layer. Done right you get code like the following, var url = _urlRepo.GetUrl().OrderByCreateDate().ByCreatedUser("boyter"); var url…

It's funny you mention entity framework. That's what blows up tempdb on one of my many environments with some of the stupidest queries I've ever seen hit the server. Maybe your experience with entity is better than mine, but I personally think it and most other ORMs are complete garbage.

I agree with this (sort of). I find Entity Framework very usable and it does help you write descriptive and maintainable code, but the SQL queries it ends up writing makes it a performance nightmare. YMMV of course but for applications where performance is important I haven't found EF to perform adequately. As ORMs go all I really want is an abstraction layer and the mapping from query to POCO classes without the performance hit. Currently using Dapper.

Re: Why I love databases

#112
post #64
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…

I agree. These days, I tend to approach a persistency implementation by asking myself: * will it be read or write heavy? * by what data/key will I access the persistent data? Most commonly for the type of work that I do, it's write once - read N number of times. What I end up doing then is just to keep the data in-mem in a hash table while writing it async to disk. Concurrent reads hit the hash table while the disk w…

That's my usual approach as well. Usually an app's data will easily fit in memory within one process (and if it doesn't, that means the app has become so popular that adding an extra X GB of memory is an insignificant cost). Using the language's native data types and an append-only file for persistence is simple and offers high performance compared to doing all access over a socket.

Re: Why I love databases

#113
post #83

I love databases, but I loathe SQL. And no, I don't mean NoSQL is better - that's throwing out the baby with the bathwater. To me, SQL is the Common Lisp of relational languages - a brilliant invention of its time that has since long-overstayed its welcome and should be replaced by modern considerations of the problem it solves. The difference is that there are a million rethinks and descendents and redesigns of LISP…

Your rant doesn't need a point-by-point response. Problems always exist when you attempt to force-fit two idiomatically divergent languages.

SQL was designed for reading and updating relational data. Data in tables that can be joined with relational intersections, unions and complements. For that it does its job. Idiomatically, it has its own "code modularity" paradigm. (And no, I don't mean stored procedures here).

Object-oriented folks want to overlay the object paradigm and the attendant idiomatic language aspects on top of SQL. Painful, but not the fault of SQL's.

This is your proverbial impedance mismatch. We have to "deal with it" without compromising the idiomatic strengths of either paradigm.

Re: Why I love databases

#114
post #69

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 eas…

Hey, can you suggest some good reads for understanding databases enough to build a simple relational database ...

You can look at all the open source databases that are out there. You can also look at things like FoundationDb and their SQL layer. It shows how you can build a relational api on top of a NoSql db with transactions. I think that will be open source on GitHub https://github.com/FoundationDB/sql-layer.

Re: Why I love databases

#115
post #113
post #83

I love databases, but I loathe SQL. And no, I don't mean NoSQL is better - that's throwing out the baby with the bathwater. To me, SQL is the Common Lisp of relational languages - a brilliant invention of its time that has since long-overstayed its welcome and should be replaced by modern considerations of the problem it solves. The difference is that there are a million rethinks and descendents and redesigns of LISP…

Your rant doesn't need a point-by-point response. Problems always exist when you attempt to force-fit two idiomatically divergent languages. SQL was designed for reading and updating relational data. Data in tables that can be joined with relational intersections, unions and complements. For that it does its job. Idiomatically, it has its own "code modularity" paradigm. (And no, I don't mean stored procedures here).…

With some small changes to SQL you can get something similar that probably gets closer to what he describes. Seems to be called NewSql in a lot of cases. One thing some people like with sql is that the query engine translates the language to the actual query. If this is what you want you can build it on top of many databases. Being able to return something more advanced than simple tables would also be nice in a lot of cases.

Re: Why I love databases

#116
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…

But if the storage is a storage library the developers wouldn't be reinventing it every time. And if a new technolgy came along it might be easier to start using it than to say that all applications in an organization must use the same (often relational) db. The latter seems to be very common. And the dba's don't seem to push the use of newer technology much, or look into how much time it would save the developers. Regarding tooling, you are right, it is a bit lacking with the newer database solutions but they seem to be working on it and I think it would help if everyone involved tried to help describe what kind of tooling is needed/wanted. Now a lot of discussions stops with saying the tooling isn't good enough and noone should ever use the new database solutions.

Re: Why I love databases

#117
post #56
post #52

Since we're discussing databases...is there any "golden standard" learning resource/introduction to PostegreSQL? As a college student, I do not have much experience with them yet but I am aware of how important it would be to be comfortable with them in your day to development. Something tells me that my usual approach of diving in and tinkering by building out an idea wouldn't serve me as well for db's; it just seem…

I would recommend "Architecture of a Database System" by Joe Hellerstein, Micheal Stonebraker, and James Hamilton [0] as a start if you want formal perspective without getting too much into theory. [0] http://db.cs.berkeley.edu/papers/fntdb07-architecture.pdf

As a sidenote, Michael Stonebreaker himself is nowdays building VoltDb which is a memory-db that he thinks is much more evolved than relational systems. I havn't used it but it looks interesting. I did try OrigoDb which is an open source .NET based memory db and it worked great for my needs and the queries are really fast.

Re: Why I love databases

#118

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 eas…

A database...... in javascript... The only thing next(probably already done) is a mailserver.

I think Haraka[0] pre-dates JS databases.

[0] https://haraka.github.io/

Re: Why I love databases

#119
post #118

Earlier quoted context omitted.

A database...... in javascript... The only thing next(probably already done) is a mailserver.

I think Haraka[0] pre-dates JS databases. [0] https://haraka.github.io/

Since we have:

http://bellard.org/jslinux/

We also should have the haraka package.

Re: Why I love databases

#120
I like SQL. It makes sense to me, personally. Even when I get really unwieldy, I can always take a step back and break it down to parts. If I'm allowed to use temp tables, I can do almost anything in it and usually a lot faster than developers in their language can.
Post reply on HN