Live data from Hacker News

Why you should learn SQL

executeprogram.com

41–50 of 137 posts

Re: Why you should learn SQL

#41

Earlier quoted context omitted.

And even if you don't want to normalize, at least don't make the DB basically incomprehensible. Speaking from experience, a "abnormalized" db sucks. https://news.ycombinator.com/item?id=27842820

Yeah one should know why it’s important to normalize, and then when they go a different path, it is done consciously and not because they are inexperienced and didn’t really know any better. Folks out there who don’t want to learn the ins and outs of database theory - please don’t; read up on it, it’s a very important skill & knowledge to have and doesn’t take long to master. It does take a few days, perhaps weeks, f…

For Databases, it takes me a concious effort to not go to at least 3rd NF.

Except for addresses/names/telephone numbers, I have been burned by ANY assumption I made. Those, I tend to just store as something like char(255) nowadays by default, unless business requirements force me to split it up, but even then, after voicing my concerns.

Edit: reading up on the addresses falsehoods again, 255 may not be enough.

https://www.kalzumeus.com/2010/06/17/falsehoods-programmers-...

https://github.com/google/libphonenumber/blob/master/FALSEHO...

https://www.mjt.me.uk/posts/falsehoods-programmers-believe-a...

Re: Why you should learn SQL

#42

Earlier quoted context omitted.

All of it is completely irrelevant unnecessary complexity. Learn to use Tinkerpop.

Curious that 99.99% of applications use an SQL database, must just be a lot of really bad developers. Am I so out of touch? No, no, it’s the children who are wrong.

You can patronize me all you want, it does not rectify the fact that you are out of touch with modern database technologies and prefer what you know works.

Re: Why you should learn SQL

#43

Earlier quoted context omitted.

The closest that many have come to is to develop ORM libraries. LINQ + EntityFramework Core is my favorite.

He said better than SQL.

To me, ORM code is better than raw SQL.

But, a lot many applications can be developed without really knowing the depths of SQL with help of the ORM itself.

Re: Why you should learn SQL

#44

Earlier quoted context omitted.

> and the DB figures out an execution plan. And then you spend the next hour trying to decipher the plan and work out how to get it to do something that isn't insanely slow.

Maybe create foreign keys and indexes in your Rails migrations

I had a crazy case where after adding indexes to things, queries suddenly become much much slower. I had to look over the plan and realized that removing these indexes made queries fast again. Turns out you can't just take for granted that an index will speed things up and its something you actually have to test and record before/after results.

I'm still slightly at a loss as to what the issue was but the best I can find is that if you index something with lots of duplicate values, you make the query slower as it has to scan the index and then scan the long list of results.

Re: Why you should learn SQL

#45
It is indeed very helpful, actually my first class in CS colleague was SQL in oracle. I think that's one of the class that is most valuable to me without my realising it. Until now I still remember most of the language because I used it every day, it has similar syntax and understanding even when I convert to Mysql or Postgres.

Without realising it is one of the most important fundamentals that is nailed in your head, suddenly you just understand when you look at raw SQL from your ORM to debug, what went wrong etc.

Re: Why you should learn SQL

#46

We're currently moving our Druid/Kafka/Spark setup to BigQuery because of how simple SQL is.

You might find https://trino.io/ interesting. It allows you to bolt on a MPP SQL execution engine on top of any data source including pre-built connectors for Druid and Kafka.

It's all ANSI SQL and the best part is you can combine data from heterogenous sources. e.g. You can join data between a topic in Kafka and a table in Druid or even between Kafka, S3 and your RDBMS.

Disclaimer: I'm a maintainer of the project.

Re: Why you should learn SQL

#47

I am using spring hibernate. It's so powerful. I don't need to write and understand SQL anymore. Sarcasm off: I see more and more juniors without SQL skills. Various reasons they give me. From the nosql plague to some cloud solutions to the above example. SQL seems to be not so fun anymore. I have a hard time understanding that. Since data storage is such a fundamental part of your application. I would even argue tha…

SQL is useful but we’ve spent decades to abstract it away, because the Java/SQL articulation is always circumvoluted, and juniors do without. Then they load two tables in Java and join them manually in memory; or they fetch the principal record, and use the getter to retrieve the dependency, so Hibernate does one query per row. I accuse all ORMs, especially Hibernate, of making it too easy to skip SQL, and I accuse J…

Anyone that does work on the client that should stay on the server, sending wasted data across the wire has already lost it.

To this day I keep writing stored procedures, no need to multiline strings.

And for the rest just use either myBatis or jOOP, run away from Hibernate.

Re: Why you should learn SQL

#48

SQL is going to eventually die because of its three-pronged relationship model that implies query-time complexity. Learn it if you want, but especially backend and analytics people would be better off learning Gremlin or Cypher. Edit: downvoting this is not going to make it untrue.

You are getting doenvoted because it's untrue. So many faang companies using traditional SQL. And for good reasons. Not to say your two examples are bad. They have their own benefit. But don't become the guy who believes in one replacement solution for all without the knowledge of all. It's annoying

And how many FAANG companies are using a graph database?

Re: Why you should learn SQL

#49

SQL is an important skill to have, in particular one should learn about database normalization and the normal forms - very important stuff!

And even if you don't want to normalize, at least don't make the DB basically incomprehensible. Speaking from experience, a "abnormalized" db sucks. https://news.ycombinator.com/item?id=27842820

There's reasons for one wide table.

The traditional SQL database uses row based data structures.

When you shift to columnar data formats for the table, parquet or any columnar DB, the normalization rules which were developed for row based become extremely different.

The brave new world now is in-memory DBs.

All those 1970s rules, which make sense for row based tables stored on disk, don't apply to data in RAM.

At all.

So it's going to get very interesting.

Post reply on HN