You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your improvement related to a problem? Please describe.
SQL Server transport uses heap tables in order to optimize the inserts and deletes. The consequence of that design is the fact that the queue table contains much more pages then currently used -- the number reflects the maximum size of the queue table since it has been created (or shrank).
All these pages are part of the table but not actively used. The actively used pages are a subset that forms a linked list.
The assumption was that in this structure the receive query that deletes the record with lowest rowversion value first walks the index on rowversion up to a leaf that points to a page where the row exists and then that page is read. It appears that this is not the actual behavior of the SQL Server as documented below:
Given an empty table with lots of unused pages (Reserved space = 2416KB / 30000 pages) when selecting the oldest row
WITH message AS (
SELECT TOP(1) *
FROM {0} WITH (UPDLOCK, READPAST, ROWLOCK)
ORDER BY RowVersion)
SELECT * FROM message
the entire table is logically read (logical reads = 3078)
Describe the suggested solution
Investigate why the Index_RowVersion is not used
Describe alternatives you've considered
Additional Context
No response
The text was updated successfully, but these errors were encountered:
Describe the suggested improvement
Is your improvement related to a problem? Please describe.
SQL Server transport uses heap tables in order to optimize the inserts and deletes. The consequence of that design is the fact that the queue table contains much more pages then currently used -- the number reflects the maximum size of the queue table since it has been created (or shrank).
All these pages are part of the table but not actively used. The actively used pages are a subset that forms a linked list.
The assumption was that in this structure the receive query that deletes the record with lowest
rowversion
value first walks the index onrowversion
up to a leaf that points to a page where the row exists and then that page is read. It appears that this is not the actual behavior of the SQL Server as documented below:Given an empty table with lots of unused pages (Reserved space = 2416KB / 30000 pages) when selecting the oldest row
the entire table is logically read (logical reads = 3078)
Describe the suggested solution
Investigate why the
Index_RowVersion
is not usedDescribe alternatives you've considered
Additional Context
No response
The text was updated successfully, but these errors were encountered: