• vk-kirov (11/16/2011)


    ...but the question has a minor issue. When I created the QOD database with the DemoTable table and tried to rebuild the index, I got the following error message:

    The statement has been terminated.

    Msg 1101, Level 17, State 12, Line 1

    Could not allocate a new page for database 'QOD' because of insufficient disk space in filegroup 'PRIMARY'. Create the necessary space by dropping objects in the filegroup, adding additional files to the filegroup, or setting autogrowth on for existing files in the filegroup.

    #$%#$^& !!!

    You won't believe the time I spent going over my calculations again and again, to make sure I didn't mess this one up - and then I forget that rebuilding the index will temporarily require double the size. In a few hours, my mailbox will flood with ne wpost notifications of the "I want my point back" type. (kicks self)

    BTW, I deliberately chose to use a very high number of rows because I didn't want people to run the code, but to do the maths. I did run the code myself, though, but only with 100,000 rows; I used that to check the formulas in my spreadsheet, then changed the number of rows in the sheet to 1,000,000. So I guess I should have tested it with the correct number of rows. Hmmm, maybe I should just pop up the row count to a billion for the next question?


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/