3 ms·
The article also abstracts the joins, a field list and an aggregate function too. It also notes the potentially to do so with where clauses, window function an
by usgroup 4y ago
The article also abstracts the joins, a field list and an aggregate function too.
It also notes the potentially to do so with where clauses, window function and so on.
- VincentEvans 4y agoPoor choice of words on my part - I should’ve said that the main value of the refactoring as presented in the article, as I see it, is extracting an “entity” as often captured in the CTE, or in other times - in a subquery. Extracting and templating other structural components of the query in the list you provided - I personally interpret as needless complexity that is likely to make things harder rather that easier, especially considering that there’s no database-native alternative mechanism that I can point to, and I already explained that I consider text templating an anti-pattern (though perhaps it does have value in those instances where the database engine is not as full featured as postgres - sqlite as an example).