There is this weird behavior of Query Store runtime stats that I observe at many of my servers with different scenarios that makes me not to believe these stats. Or am I wrong in something?
E.g. trivial query like this with a given query plan:
Stats (sys.query_store_runtime_stats
) reports absolutely insane number of max_logical_io_reads
at some accidental interval:
But table has only 27 pages allocated altogether!
I am experiencing this phenomenon with different queries cross many environments. And it's ruining my regressed query analysis.
Queries with different numbers of reads don't have different plans.
The heap table shown only updates and inserts rarely. It's just coincident I used a heap as an example. I experience this with clustered tables too.
Best Answer
Pathology!
This could happen to queries in ways that wouldn't impact the plans:
Additionally some selects that cause writes may trigger additional reads if there are stats updates, spills, spools, etc. Though none of those show in your plan, someone else may some along later and find this tidbit useful.
Heaps
Run a simple query:
Look at the table: No forwarded fetches.
Cause some forwarded fetches:
If you run the count and forwarded fetch query again, you should see:
But the execution plan will be the same.
Indexes
Create a dummy table do I don't mess up my real Users table:
Check on the table size:
Should be 44,450 pages and 348MB.
Simple query:
Update the DisplayName column to be the max length (nvarchar 40):
Now the table is much larger:
88,392 pages, 691MB.
Query results: