A great way to spend an afternoon is watching past #tech talks at conferences... no?
Well, if it's interesting enough to you, maybe take a look at "Stats roll, baby, stats roll" from Cédric Villemain, presented at #FOSDEM2025. Here, he discusses using the PACS (#PostgreSQL Advanced Cumulative Statistics) extension to explore what is offered by #Postgres as well as how to define your own new kind of statistics.
https://mirrors.dotsrc.org/fosdem/2025/ua2220/fosdem-2025-4496-stats-roll-baby-stats-roll-.mp4