News for hackers. Stuff that matters.
Re:Show HN: PRQL in PostgreSQL by Izkata on Monday February 19, 2024 @02:34PM (#39433715)
> You can write queries with CTES to improve readability, and extract CTEs into functions that can be selected as queries get too large and unwieldly.

Personally I'd go for breaking them into views. IIRC as of around postgres 11-13 they're no longer a barrier for the query planner.

Re:Show HN: PRQL in PostgreSQL by CuriouslyC on Monday February 19, 2024 @02:54PM (#39433966)
You are right, views are a good choice in a lot of instances. Functions give you more behavioral flexibility, easy multiple version support (in postgres) and fewer issues with ddl dependencies, but views are semantically clearer, easier to work with and give good usage flexibility.