April 9, 2023 at 4:26 am
If the index is created, you should be able to find it in the sys.indexes table
April 9, 2023 at 5:30 am
thank you for this.
I am a rookie so excuse the ignorance. I need to re-calculate the index after a certain calculation is done. I thought that using the script I created would do the job. How would using sys.indexes help me?
April 9, 2023 at 8:05 am
thank you for this.
I am a rookie so excuse the ignorance. I need to re-calculate the index after a certain calculation is done. I thought that using the script I created would do the job. How would using sys.indexes help me?
you don't recalculate an index - you rebuild it if/when required, or you drop and recreate (which is what you are doing).
but the main question here is WHY do you think you need to do it? does the proc where this is done do lots of deletes/updates on that table? if this is why you do it then a index reorg is needed ONLY to cleanup the deletes and recompress the deltastores. see https://www.red-gate.com/simple-talk/databases/sql-server/performance-sql-server/hands-on-with-columnstore-indexes-part-3-maintenance-and-additional-options/ for further info
and what is the number of rows on that table? if not on the hundreds of millions it likely should not be a columnstore in the first place
April 10, 2023 at 12:14 am
if this is why you do it then a index reorg is needed ONLY to cleanup the deletes and recompress the deltastores. see https://www.red-gate.com/simple-talk/databases/sql-server/performance-sql-server/hands-on-with-columnstore-indexes-part-3-maintenance-and-additional-options/ for further info
Just in case someone else reads this and misunderstands... this is for Column Store indexes and REORGANIZE is definitely the way to go here.
For Row Store indexes, I recommend avoiding REORGANIZE altogether. It simply doesn't work the way people think it does and usually perpetuates fragmentation where mid-index fragmentation occurs... like on Random Guids and other evenly distributed fragmentation.
--Jeff Moden
Change is inevitable... Change for the better is not.
April 11, 2023 at 1:07 am
Well you can be sure it gets created by doing the following
DROP INDEX [dbo].[VIXNearTermExpiration]
Then change your code to do it in two steps rather than one as follows:
DROP INDEX IF EXISTS [dbo].[VIXNearTermExpiration]
CREATE CLUSTERED COLUMNSTORE INDEX [VIXNearTermExpirationIndex]
ON [dbo].[VIXNearTermExpiration]
WITH ( COMPRESSION_DELAY = 0 )
ON [PRIMARY]
If I am understanding what DROP EXISTING = ON is doing that is. Never used this, cannot see a reason to use it. If I do not know if it exists I can look at the database to see if its there. By the not naming it IX_NearTermExpiration will mean the data modeling aspect of SSMS will not work correctly.
Viewing 6 posts - 16 through 20 (of 20 total)
You must be logged in to reply to this topic. Login to reply