I had an interesting question yesterday in class about query execution plan control flow (from the root of the plan to the leaf level) and data flow (from leaf to root) and thought I would share a small demo I put together over lunch break to walk through the discussion.<\/p>\n
Let\u2019s start by dropping clean buffers (on a test system, please):<\/p>\n
\r\nDBCC DROPCLEANBUFFERS;\r\n\r\nUSE [Credit];\r\nGO\r\n\r\nSELECT\u00a0 COUNT(*) AS [page_count]\r\nFROM\u00a0\u00a0\u00a0 [sys].[dm_os_buffer_descriptors] AS bd\r\nWHERE\u00a0\u00a0 [bd].[database_id] = DB_ID() AND\r\n[bd].[allocation_unit_id] = 15045483298816;\r\nGO\r\n<\/pre>\nThis returns 0 rows for the allocation_unit_id associated with the table we\u2019re about to query from the Credit database:<\/p>\n
\r\nSELECT\u00a0 [charge].[charge_no]\r\nFROM\u00a0\u00a0\u00a0 [dbo].[charge]\r\nORDER BY [charge].[charge_no];\r\nGO\r\n<\/pre>\nThe actual plan shows the following (via SQL Sentry Plan Explorer):<\/p>\n