New answers tagged

1

Common Table Expressions are treated as an “optimization fence” by PostgreSQL: It will never push down predicates from the main query into the CTE nor collapse any joins across the CTE boundary. Instead, it will generally evaluate the whole CTE as it is, materializing the result; the main query will then access the temporary table generated from the CTE. So ...


3

@ypercube already provides ample explanation, so I'll cut to the chase what I have to add. If the parent_id does not exist, it should leave the generation column set to -1. I assume this is supposed to apply recursively, i.e. the rest of the tree always has generation = -1 after any missing node. If any node in the tree can be missing (yet) we need to ...


1

Is there ANY way ... Finally in SQL 2016 CTP 3.0 there is a way, kind of : ) Using the trace flag and Extended Events as detailed by Dmitry Pilugin here, you can (somewhat arbitrarily) fish out three unique guids from the intermediate stages of the query execution. NB This code is NOT intended for production or serious usage as regards CTE plan ...



Top 50 recent answers are included