<< Talks

Solving the knapsack problem with recursive queries and PostgreSQL

09:10 - 09:55

Aiven Francesco Tisiot

Optimization problems are everywhere, from deciding which clothes to pack in our luggage (aka the knapsack problem), to selecting the tasks that will be worked during a sprint. Trying to solve these type of problems by hand is a tedious task often resulting in sub-optimal decisions. In this talk, we’ll understand how PostgreSQL recursive queries can help. Starting from the proper problem definition, we’ll then explore how to build queries that call themselves recursively, what are the risks associated with this approach and safeguards we can set to optimise performances. Finally we’ll demonstrate how two new features released in PostgreSQL 14 enable an easier handling of the recursive statements. If you’re into PostgreSQL and eager to understand how recursion works, this session is for you!

Francesco Tisiot
Francesco Tisiot
Aiven

Francesco comes from Verona, Italy and works as a Senior Developer Advocate at Aiven. With his many years of experience as a data engineer, he has stories to tell and advice for data-wranglers everywhere. Francesco loves sharing knowledge with others as a speaker and writer, and is on a mission to defend the world from bad Italian food!