I have a large table with the clustered index on a GUID (uniqueidentifier
) column. So the rows are not in any kind of logical order, they are physically sorted by this random-generated ID.
Does an index rebuild make any sense on such a table? Or can I just skip it and only do Stats Update? This is for SQL Server 2019 Enterprise Edition.
The rows would not be in any (date, incremental ID, etc) order anyway, they would come in a chaotic order after each other, even after an index rebuild.
I am looking if an index rebuild makes sense in such a case at all.
Does an index rebuild make any sense on such a table? Or can I just skip it and only do Stats Update?
Skip it. The random GUIDs will cause page splits on most inserts, but the steady state of that index will be to maintain ~60% free space.
If you rebuild with no fill factor, then you will generate a ton of page splits after the rebuild. And if you rebuild with a fill factor, you just rewrite the table for no good reason.
Note that if you generate the values with newsequentialid you won't have all the page splits and empty space.