Quantcast
Viewing all articles
Browse latest Browse all 3

Answer by rois for How can I improve a slow comparison query that have over partition and group by

The stated purpose of your query is to return new and updated rows from [ExternalTable]. In that case you could use EXCEPT syntax. You might also want to use temp table for [ExternalTable], because the estimates for it seem totaly wrong in the execution plan you provided. The query would look like this:

SELECT foo, bar, dataINTO #tFROM [ExternalTable]SELECT foo, bar, dataFROM #tEXCEPTSELECT foo, bar, dataFROM [Table]

Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>