• That memory consumption isn't from the query, it's from the buffer pool, memory in the buffer pool (used to cache data) isn't associated with any particular query because it's used by all of them.

    It's not specifically that the queries are consuming memory, it's that the queries are reading huge amounts of data which means SQL needs to increase the size of the buffer pool to cache that data. Only the first query that needs the data will cause the reads, later ones will read from memory.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass