silverstripe / silverstripe-framework

Silverstripe Framework, the MVC framework that powers Silverstripe CMS
https://www.silverstripe.org
BSD 3-Clause "New" or "Revised" License
720 stars 823 forks source link

Identify areas of the code that could be improved with Common Table Expressions (aka `WITH` clauses) #10962

Open GuySartorelli opened 11 months ago

GuySartorelli commented 11 months ago

https://github.com/silverstripe/silverstripe-framework/issues/10902 adds a new abstraction API for common table expressions (CTEs).

CTEs are a powerful way to create recursive queries (e.g. to find all ancestors - parents of parents - for a given record) and to optimise queries which are, for example, adding a join to a sub-query (e.g. SELECT x FROM y INNER JOIN (SELECT a FROM b);)

Notes

Acceptance criteria