4 ms·
I prefer actually materializing the tables so then I can check the output for what the transform tables and the joined tables look like. generally can't just s
by hackernewds 4y ago
I prefer actually materializing the tables so then I can check the output for what the transform tables and the joined tables look like.
generally can't just swap transformed in final because final depends on the output of transformed?
- Bootvis 4y agoThe trick is to change the name of the CTE in your final select. This will allow you to inspect that particular step. This works as long as your CTE’s are correct SQL and only the logic is wrong or suspect.
- Ntrails 4y agoI guess the point is you could just stick the results of each step that is currently a CTE into #table as separate queries, and you're only doing the work once to step through the stages? From a debug point of view that feels more convenient to _me_.
- Bootvis 4y agoI guess it depends, materialising all the steps might be slow and you might need to do a refactor to get a CTE-based query. If you want just want to check a few (maybe changing) records because you expect problems there a final select with an appropriate where is probably faster. Edit: also I don’t like to leave a mess behind and CTE’s don’t require cleaning up afterwards.
- dx034 4y agoWith CTEs, the optimizer won't execute the queries but create one optimized version. If you materialize them, execution times can be many magnitudes higher in cases you only end up using small parts of the queries.