• Advent of Code in PostgreSQL: Tips and Tricks from 2022

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.

• Fun with Postgres ASCII Map and Cardinal Directions

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.

• Fun with Postgres Text File Mazes, Charts, and Routes

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.

• Fun with Postgres Looped Functions and Linear Progressions

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.

• Fun with Postgres Floats, Positioning, and Sequencing

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.

• Fun with PostgreSQL Puzzles: Recursive Functions with Animations

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!

• Fun with PostgreSQL puzzles: Surface Area and 3D Slices

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.

• Fun with PostgreSQL Puzzles: Moving Objects with Arrays, Sequences, and Aggregates

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!

• Fun with PostgreSQL puzzles: Finding shortest paths and travel costs with functions

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.

• How to Solve Advent of Code 2022 Using Postgres - Day 15

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.

• How to Solve Advent of Code 2022 Using Postgres - Day 14

Day 14 of AOC we have new hands on SQL for the Distress Signal. This one uses lag(), sequencing, regexp_replace(), and overlay().

• How to Solve Advent of Code 2022 Using Postgres - Day 13

Day 13 of AOC we have new hands on SQL for the Distress Signal. This one uses lag(), sequencing, regexp_replace(), and overlay().

• How to Solve Advent of Code 2022 Using Postgres - Day 12

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.

• How to Solve Advent of Code 2022 Using Postgres - Day 11

Day 11 of AOC, Greg uses SQL for playing Monkey in the Middle. This one uses sequences, string functions, and window functions.

• How to Solve Advent of Code 2022 Using Postgres - Day 10

Day 10 of AOC we have new hands on SQL for reading signals. This one uses sequences and the OVER() function.

• How to Solve Advent of Code 2022 Using Postgres - Day 9

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.

• How to Solve Advent of Code 2022 Using Postgres - Day 8

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.

• How to Solve Advent of Code 2022 Using Postgres - Day 7

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.

• How to Solve Advent of Code 2022 Using Postgres - Day 6

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.

• How to Solve Advent of Code 2022 Using Postgres - Day 5

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.