Thinking about solving the Advent of Code in Postgres? I did it last year and I have summary of how to get started and some tips and tricks for writing your own solutions.
Greg has more solutions to the last Advent of Code, this is day 23. Here he takes an ASCII map of dots and hashes and looks for free spaces with cardinal directions. Some fun SQL in here with table rebuilds and ANSI color charts all inside plain PostgreSQL.
Greg has more solutions to the last Advent of Code. He takes the text input file and solves the puzzle by charting a route through a maze. With some cool settings, these animations run inside psql.
More Advent of Code solutions in PostgreSQL, this is day 21. Greg separates out the monkey speak and creates looped functions to predict what they're saying. For bonus points, Greg shows off the new friendly big number inputs in Postgres 16 that use a format like BIGINT = 1_000_000_000.
Greg continues to amaze us with solutions to the 2022 Advent of Code, this is day 20. Using only PostgreSQL he decrypts data, gets it sequenced, and gets back on his journey to meet up with the Elves.
Greg continues with Advent of Code series in Postgres with puzzle 19. This one uses recursive functions to follow blueprints and return the results. These functions even have terminal animations to show results as they are processed!
Greg continues with more puzzles and solutions for the Advent of Code series, today covering day 18's puzzle. Greg has some amazing functions for surface area, heat maps, and 3d visualizations.
Greg continues with Advent of Code series, this one is puzzle 17. This one works with falling rocks. Using sequences, arrays, and aggregates he makes a stackable objects with nothing but SQL!
Greg is still working on some of the puzzles in the Advent of Code series. In this one he tackles some routes, shortest paths, and cost. These are great sample PostgreSQL functions withs some bonus tips on using pg_stat_user_functions to look at recursion.
Day 15 of AOC we have new hands on SQL for the Beacon Exclusion Zone. This one uses CTEs, sequences, regexp_substr() / regexp_match(), int4range, range_agg(), and an upsert.
Day 14 of AOC we have new hands on SQL for the Distress Signal. This one uses lag(), sequencing, regexp_replace(), and overlay().
Day 13 of AOC we have new hands on SQL for the Distress Signal. This one uses lag(), sequencing, regexp_replace(), and overlay().
Day 12 of AOC we have new hands on SQL for the Hill Climbing Algorithm. This one uses parsing, an IDENTITY column, functions, and text arrays.
Day 11 of AOC we have new hands on SQL for playing Monkey in the Middle. This one uses sequences, string functions, and window functions.
Day 10 of AOC we have new hands on SQL for reading signals. This one uses sequences and the OVER() function.
Day 9 of AOC we have new hands on SQL for looking at a rope bridge. This one uses a custom function and colored ASCII art.
Day 8 of AOC we have new hands on SQL for reviewing treetop views. This one uses includes PL/pgSQL, row_number window functions, sequences, and regexp_split_to_table.
Day 7 of AOC we have new hands on SQL for reviewing terminal commands. This one uses recursive queries, text arrays and so many functions. Bonus, there are functions for regexp_count, regexp_replace, and regexp_substr which are new in Postgres 15.
Day 6 of AOC we have new hands on SQL detecting markers in datastreams. This one uses regexp_split_to_table, strpos, lag() functions and COUNT(DISTINCT). Also, a great example of using a DO function with RAISE NOTICE.
Day 5 of AOC we have new hands on SQL for helping stack crates. There are some cool PL/pgSQL for moving things around. Plus generate_series(), upsert ON CONFLICT, and backwards sequencing.