1 min readMar 11, 2019
Hey Satheesh, Indeed.
CTE’s can be use be very useful when used for their intended purpose — optimization boundaries. If, as you describe, you want to reuse the results of a query from a remote DB (such as a replica) within a single query, it makes sense to materialize it using a CTE.