Home Forums SQL Server 2016 SQL Server 2016 - Development and T-SQL Odd behavior -- execution plan different when I execute in the target database vs not in the target database RE: Odd behavior -- execution plan different when I execute in the target database vs not in the target database

  • TheSQLGuru - Monday, May 7, 2018 6:05 PM

    Maybe DB2 has the same objects and something different (like 10000X more data, missing indexes, different data types, etc)?

    The best way to help you is to post the query plans.

    Good to see you back Kevin! Hope all is well.

    In adition to Kevins comments, different server settings and available resources. That said, If you're getting a spill to tempdb in one but not the other, the usual suspects are massive desparities in row counrs (already mentioned by Keni) and/or out of date stastics on one instance but not the other. Also, check to make sure both versions are set to use the same compatibility level and the same version of the cardinality estimator.