Advent of Code 2024 in pure SQL
51–60 of 110 posts
Re: Advent of Code 2024 in pure SQL
#52Re: Advent of Code 2024 in pure SQL
#53It takes an incredible human to do something like this. Pure art. Not enough of that in the programming world.
Re: Advent of Code 2024 in pure SQL
#54Earlier quoted context omitted.
> Once you stop thinking iteratively and start thinking in set operations it becomes quite natural and powerful. I dunno... I've written a tremendous amount of SQL, and I still have to think imperatively (iteratively) in order to write queries that are actually performant, and to know which indexes need to exist. It would be wonderful if I could just think in terms of set operations, but that tends to result in queri…
It may be true, until you do your ETL in an index-less database such as BigQuery or Trino. Postgres will always be faster for optimized, end user serving, queries. But BigQuery allows you to scale it to 100s of CPUs without having to worry about indexes.
I would do almost any amount of iteration and index tuning to keep the query on a single machine rather than deal with a networked distributed system.
When you get slow queries the real problem is algorithmic complexity and linear workers only can do so much,
Re: Advent of Code 2024 in pure SQL
#55Earlier quoted context omitted.
This is just a guess, but if the OP's reason is similar to mine, DBMSs should be reserved for managing databases and not implementing complex logic.
Why not? I think the main barrier is the programmers are not comfortable with recursion, rather than a technical limitation.
Mystery triggers, unclear or badly managed stored procedures, opaque invariants. It’s not to say that all of these things are bad, but a certain level of DB complexity will naturally set off alarm bells for some devs.
Re: Advent of Code 2024 in pure SQL
#56https://clickhouse.com/docs/en/integrations/data-formats/tem...
Re: Advent of Code 2024 in pure SQL
#57Earlier quoted context omitted.
Why not? I think the main barrier is the programmers are not comfortable with recursion, rather than a technical limitation.
I’d hazard a guess that quite a few devs have at one point, been lumped with a db where someone pushed too much logic into it. Probably great for the one person who wrote it, and awful for everyone else. Mystery triggers, unclear or badly managed stored procedures, opaque invariants. It’s not to say that all of these things are bad, but a certain level of DB complexity will naturally set off alarm bells for some devs…
Re: Advent of Code 2024 in pure SQL
#58Re: Advent of Code 2024 in pure SQL
#59Re: Advent of Code 2024 in pure SQL
#60Earlier quoted context omitted.
> Consider that one wouldn't complain as much about a super fucked up nested query (and resulting SQL syntax woes) if it wasn't necessary to write such a query in the first place. And in "modern" SQL this is solved with CTEs. Use them to unwrap the schema the way you want it first, before implementing the business logic.
this is poor man's SQL to unwrap for business logic. SQL is such more more about everything else and so litte about the trouble with mapping business logic into storage.