Live data from Hacker News

Ask HN: SQL or NoSQL?

news.ycombinator.com

11–20 of 26 posts

Re: Ask HN: SQL or NoSQL?

#11

I no longer buy the "use relational databases for relational data, use NOSQL for non-relational data" mentality. Basically all meaningful data in an application context has relationships. There is no real such thing as "non-relational data" Instead the question really is do you want a planned, enforced schema or an unplanned, freeform one. Use a SQL database for the former. Take a long look in a mirror and question t…

To add to this: with Postgresql's JSON type, it's very easy to mix the two. We use relational data for most things to get the benefits of an enforced schema, but in places where freeform is preferable we stuff that data in a JSONB column. I can't think of any projects that would need more flexibility than that provides.

Re: Ask HN: SQL or NoSQL?

#12

All ways use SQL NoSQL is for incompetent people who can't figure out how to convert a JSON request to a table structure. They just put the entire JSON as it is in a DB and call it NOSQL. Anyone using NoSQL for anything is either lying or clueless.

You’re completely ignoring the situations where your doing things like exploratory development or free form data processing.

If you’re dealing with enough data you want to start having an index here or there to speed up the queries you’re developing for whatever reason. I’ve done some data exploration work against things like the Python Package Index where the size of the dataset had put off more significantly resourced groups have abandoned projects in the past. For me to get useful data out of that in a reasonable timespan required repeatedly prototyping the queries what data I kept, and how I was loading it. UnQlite (sort of a nosql version of SQLite) was my secret weapon. I could build things in iterations extremely easily with each generation of the code wrapped up in simple scripts for easily measuring the timing of each stage allowing me to optimise things to eventually get the answers I was looking for with a job that took less than an entire weekend to run and with an optimal data set size that only ended up keeping a few GB of the much larger data I started with. This would have been WAY more work for me with with a SQL database.

Re: Ask HN: SQL or NoSQL?

#13

I no longer buy the "use relational databases for relational data, use NOSQL for non-relational data" mentality. Basically all meaningful data in an application context has relationships. There is no real such thing as "non-relational data" Instead the question really is do you want a planned, enforced schema or an unplanned, freeform one. Use a SQL database for the former. Take a long look in a mirror and question t…

To add to this: with Postgresql's JSON type, it's very easy to mix the two. We use relational data for most things to get the benefits of an enforced schema, but in places where freeform is preferable we stuff that data in a JSONB column. I can't think of any projects that would need more flexibility than that provides.

Adding to this is the support for queries on the JSONB column which combined with computed table columns and the support for indexes (including sparse indexes) on JSONB columns. You can throw a bunch of stuff you don’t know how to deal with yet that you know you will need to deal with later... then gradually massage out the important parts, expose them to code using the table in a normal SQL style manner, test if things make a difference to indexes, and then eventually promote relevant information out of the unstructured data in the JSONB column up to a place in the fully specified SQL table with an appropriate column type and everything.

It’s a fantastic way to build an exit strategy for situations where original developers a picked NoSQL database and current developers want to replace it with a more structured SQL database.

Re: Ask HN: SQL or NoSQL?

#14
I think the choice boils down to a few questions:

- do you need relational data, or something more simple, or something more flexible ?

- do you need transaction integrity ? Transaction integrity is a nice feature, but you can also design all your code so that if something blows "in the middle", it is somehow repaired automatically in a further event.

Maybe a third point: most of our relational / transactional database technology is quite old. Could we do something better than SQL query language, common database types, and the actual database code that was very optimized for magnetic spinning disks, but maybe is not optimized for SSD ? Maybe, we would need something like SQLV2.

And my god how much hype bullshit is inserted in those technical discussions.

Re: Ask HN: SQL or NoSQL?

#16

I no longer buy the "use relational databases for relational data, use NOSQL for non-relational data" mentality. Basically all meaningful data in an application context has relationships. There is no real such thing as "non-relational data" Instead the question really is do you want a planned, enforced schema or an unplanned, freeform one. Use a SQL database for the former. Take a long look in a mirror and question t…

Having worked with NoSQL apps, I would say that NoSQL simply move the burden of maintaining data integrating inside the application code. I would recommend default should be SQL and NoSQL should be used only if it really is impossible to do it in SQL.

Re: Ask HN: SQL or NoSQL?

#17

> My understanding was always that for relational data (e.g., social networks) you should use a relational database. I thought you were supposed to use a graph database for that, like dgraph. Do I remember incorrectly? > Dgraph is a horizontally scalable and distributed GraphQL database with a graph backend. --- Edit: found the source... According to https://www.infoworld.com/article/3251829/why-you-should-use... : "…

This is what I thought the tweet would be referencing, but since the author is talking about posts, comments, etc. the alternative is clearly not saying a graph database (which is good for social connections) is optimal.

Realistically, it just seems like a low-effort attempt to dunk on Parler for likes and retweets.

Re: Ask HN: SQL or NoSQL?

#18
Nine joins is not a big deal, you simply filter data before joining. And that is only if tables are fully normalized, no one does that. For example, current avatar and user info maybe in same table. Post and permission will likely be in the same table.

Of course, you will use materialized views for even better performance.

Re: Ask HN: SQL or NoSQL?

#19
whenever someone makes blanket technical statements in this crazy boasting fashion, i think of Yeats:

> ...the worst are full of passionate intensity.

that said, it's difficult to feel sympathy for people supporting a platform that encourages terrorism, murder, etc.

Re: Ask HN: SQL or NoSQL?

#20

All ways use SQL NoSQL is for incompetent people who can't figure out how to convert a JSON request to a table structure. They just put the entire JSON as it is in a DB and call it NOSQL. Anyone using NoSQL for anything is either lying or clueless.

You’re completely ignoring the situations where your doing things like exploratory development or free form data processing. If you’re dealing with enough data you want to start having an index here or there to speed up the queries you’re developing for whatever reason. I’ve done some data exploration work against things like the Python Package Index where the size of the dataset had put off more significantly resour…

> for easily measuring the timing of each stage

Why would easily measuring the timing of each stage be way more work with an SQL database but way easier with a NoSQL database?

Post reply on HN