4 ms·
I wish SQL had syntax more similar to dplyr[1] for complicated queries. I dislike having to do a nested sub-query every time I re-group the data - the query end
by alexhutcheson 7y ago
I wish SQL had syntax more similar to dplyr[1] for complicated queries. I dislike having to do a nested sub-query every time I re-group the data - the query ends up being a deeply indented mess that needs to be read from the inside-out. Using "WITH" clauses helps a lot, but it's still not as easy to read as the more imperative dplyr style.
[1] https://dplyr.tidyverse.org/ https://dplyr.tidyverse.org/
- gigatexal 7y agoBe wary of WITH statements as they are optimization barriers as some engines can't optimize them -- that's changing but just FYI. I believe the latest Postgres release is handling them properly now -- I could be wrong.
- alexhutcheson 7y agoGood note. Subqueries are sometimes optimization barriers as well - it depends on query engine. If you care about performance you need to look at the query plan.
- gigatexal 7y ago"If you care about performance you need to look at the query plan." Always I would say, once your data gets above toy size.
- mizay7 7y agowe use azure data explorer for a lot of data storage. It is a terribly boring name but it highly performant at a large range of data sizes, stores rectangular (table) data with clear schematization, and uses the piping type of syntax of tidyverse. I love it. I really wish they would rebrand and market it more.
- LessDmesg 7y agoThis, this so much. The thing I hate the most about SQL is its declarative, deeply-nested syntax with alias declarations way inside. In a normal language you can't use a variable outside its declared scope, but in SQL it's a Wild West. Pervasive CTEs and CASE statements are the best way out of this mess, I find.