7 ms·
> couldn't even write a basic sql query Not the point at all, but I have found it quite common among younger professional engineers to not know SQL at all. A c
by runako 1y ago
> couldn't even write a basic sql query
Not the point at all, but I have found it quite common among younger professional engineers to not know SQL at all. A combination of specialization (e.g. only work on microservices that do not directly touch a database) and NoSQL has made the skill of SQL more obscure than I would have thought possible as recently as 5 years ago.
- ElCapitanMarkla 1y agoI started to notice this in a big way at my last job which I started in 2013. We were a rails shop and by about 2016 I was noticing most new hires would have no idea how to write a SQL query.
- cultofmetatron 1y ago> most new hires would have no idea how to write a SQL query. probably why people think rails is slow. our integration partners and our customers are constantly amazed by how fast and efficient our system is. The secret is I know how to write a damn query. you can push a lot of logic that would otherwise be done in the api layer into a query. if done properly with the right indexes, its going to be WAY faster than pulling the data into the api server and doing clumsy data transformations there.
- hollowturtle 1y agoYou actually confirmed that rails is slow if the optimization is on the database server and doing data mangling in ruby is less efficient
- richwater 1y agoYou've correctly identified that filtering a list is slower than looking up from an index. Congratulations.
- hollowturtle 1y agoThank you, let me give you the eli5: I just wanted to say that you can't claim that something is fast if speed is thanks to something else
- runako 1y agoConstructively, I would suggest some areas for study: - relative speeds of programming languages (https://github.com/niklas-heer/speed-comparison https://github.com/niklas-heer/speed-comparison) - database indexing (https://stackoverflow.com/questions/1108/how-does-database-indexing-work https://stackoverflow.com/questions/1108/how-does-database-i...) - numbers everyone should know (https://news.ycombinator.com/item?id=39658138 https://news.ycombinator.com/item?id=39658138) And note that databases are generally written in C.
- hollowturtle 1y agoConstructively, I just wanted to say that you can't claim that something is fast if speed is thanks to something else. OP said people thinks rails is slow but if you have a fast query it's a solved problem. Even python would be fast in this instance with an optimized query
- cultofmetatron 1y ago> Even python would be fast in this instance with an optimized query I wasn't trying to argue that ruby is slow (it objectively is). I was arguing that its slowness is irrelevant for most webapps because you should be offloading most of the load to your database with efficient queries.
- closeparen 1y agoUnless the database is in your process's address space (SQLite, Datomic, etc) your first problem is going to be shipping the data from the database server to the application process.
- strtok 1y ago1000%. It’s all about limiting those round trips to the database…
- ggregoire 1y agoThat's so weird to me, SQL is the very first language they taught me in college 20 years ago, before even learning how to write a for loop in pseudo code. Nowadays it's still the language I use the most on a daily basis.
- ramchip 1y agoIt's a wide field so it depends on the specialization. I did computer engineering 15+ years ago and we never touched SQL, but I think the software engineering people did have a class on it.
- sampullman 1y agoI learned it ~15 years ago, and when I use it a lot it sticks with my pretty well. But if I go a month or two without writing raw queries I lose anything more advanced than select/update/delete/join. I think I forget it faster than other things because none of syntax/semantics aren't shared with anything else I use.
- deleted 1y ago[deleted]
- closeparen 1y agoYou should at least know how to query your data warehouse environment to debug your services / find out if they're working!
- ASinclair 1y agoI'm nearly guilty of this. I've been in industry for a bit over 10 years and I can barely write SQL. That's despite writing a bunch of queries by hand in my undergrad databases course. I almost never deal with databases myself outside of some ad-hoc queries.
- phito 1y agoSame here, mostly because I avoid it because I really do not like writing queries. Something about the syntax rubs me the wrong way, especially if I have to switch from MySQL/Postgres/MSSQL regularly. I'll use an ORM whenever I can, if performances do not matter.
- mattmanser 1y agoIt's because it's logically in the wrong order, it should be: FROM Users WHERE Type = 'Foo' SELECT id, name They use the right order in a lot of ORMs and as I was a SQL expert (but not master), I found it so jarring at first. You probably have the reverse problem, it doesn't fit your mental model which is in fact the right logical model. It gets even worse when you add LIMIT/TOP or GROUP BY. SQL is great in a lot of ways, but logically not very consistent. And UPDATE now I think about it, in SQL Server you get this bizarreness: UPDATE u SET u.Type = 'Bar' FROM Users u JOIN Company c on u.companyId = c.id WHERE c.name = 'Baz'
- skydhash 1y agoThat's because in the relational model, you deal mostly in terms of projections. There's an action and then the rest of the statement is creating the projection of the data the action will apply to. The action always applies to the whole of the projection (IIRC).d The semantics of SQL and a standard programming language are quite different as they are based on different computing/data model.
- cultofmetatron 1y agoyou would LOVE ecto. its an elixir dsl for writing sql and fixes all the issues I have with sql including what you just mentioned here
- chadcmulligan 1y agoI dont think they teach SQL or relational algebra any more, or at least its easy to get an IT degree and avoid it altogether.
- nevir 1y agoI see this too, also for engineers that have only interacted with relational dbs via ORMs & query builders
- abustamam 1y agoI've been a full stack engineer for 10 years and I know SQL syntax but a few years ago I was asked at an interview "make a relation between users and posts" and I went "rails generate user" or something, and he's like, "not that," so I was like "OK I'll add it to a prisma file" and he's like "not that, write the SQL. I dunno what to do because this has never happened before." Needless to say, I did not get the job, but several years later I still don't know how to answer his question. I've worked with NOSQL (Mongo/Mongoose, Firebase) and I've worked with ORMs (Prisma, drizzle, Hasura), and I've been able to implement any feature asked of me, across several companies and projects. Maybe there's a subset of people who really do need to know this for some really low level stuff, but I feel like your average startup would not. I think maybe it's similar to "can you reverse a linked list" question in that maybe you won't need the answer to that particular question on the job, but knowing the answer will help you solve adjacent problems. But even so, I don't think it's a good qualifier for good vs bad coders.
- Zizizizz 1y agoI would assume he means creating a foreign key relationship from the posts and users table. Doesn't rails or prisma have a SQL migration tool? (Upon looking it looks like it's Active Record) So the equivalent of `rails db:migrate` after doing what you suggested in the interview. You could write in SQL as.. ``` ALTER TABLE posts ADD COLUMN user_id INT, ADD CONSTRAINT fk_user FOREIGN KEY (user_id) REFERENCES users(id); ``` I don't know if that's what he was after but that's what my mind jumped to immediately. I'd recommend learning a bit as sometimes I've found that orms can be a lot slower than writing plain SQL for some more complex data fetching.
- shortrounddev2 1y agoI think ORM did a lot of that too
- gavinray 1y agoTerrifying.
- bapak 1y agoI don't deal with SQL and my knowledge of it is limited to what I learned in high school a long time ago, but… isn't SQL like super easy? What's so difficult about it that people don't know how to use it? To me git is harder and I use that tool daily.
- slightwinder 1y agoIt's simple if you've learned it, but a bit hard to remember on specific details if you are not using it regulary. And every database is also a bit different on the advanced features.