January 8, 2018 at 1:06 pm
Comments posted to this topic are about the item Get Index Scan Count
January 8, 2018 at 3:02 pm
One problem with the script is that it is hard coded to use db_id 70 when using this:
sys.dm_db_index_physical_stats (70, NULL, NULL, NULL, NULL) AS p
Maybe change that to Default, null or 0 instead of 70
Sue
January 8, 2018 at 5:58 pm
Sue_H - Monday, January 8, 2018 3:02 PMOne problem with the script is that it is hard coded to use db_id 70 when using this:
sys.dm_db_index_physical_stats (70, NULL, NULL, NULL, NULL) AS pMaybe change that to Default, null or 0 instead of 70
Sue
Oh thanks for pointing that out Sue. Not sure if I can change it now.
January 9, 2018 at 12:57 am
You should mention in that script that it's index scans since the last time the database or SQL Server were restarted. Not over all time.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 9, 2018 at 1:26 am
Thanks Gail. Actually I had put that in brackets. I think I lost it when re-editing for some other words, and then didn't proof-read; Did this in wee hours of the morning before dawn.bad habit .
January 9, 2018 at 1:30 am
Sue_H - Monday, January 8, 2018 3:02 PMOne problem with the script is that it is hard coded to use db_id 70 when using this:
sys.dm_db_index_physical_stats (70, NULL, NULL, NULL, NULL) AS pMaybe change that to Default, null or 0 instead of 70
Sue
DB_ID() would probably be more efficient, since dm_db_index_usage_stats is scoped to the current DB.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 9, 2018 at 1:39 am
Yes Gail. Sue had pointed this too. This is the first script I posted and also no idea how can edit it now. Can u help ?
January 9, 2018 at 3:18 am
I'm not a site moderator.
And I know Sue pointed it out, that's why my post was a reply to Sue
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 9, 2018 at 6:44 am
GilaMonster - Tuesday, January 9, 2018 1:30 AMSue_H - Monday, January 8, 2018 3:02 PMOne problem with the script is that it is hard coded to use db_id 70 when using this:
sys.dm_db_index_physical_stats (70, NULL, NULL, NULL, NULL) AS pMaybe change that to Default, null or 0 instead of 70
Sue
DB_ID() would probably be more efficient, since dm_db_index_usage_stats is scoped to the current DB.
I referenced this: sys.dm_db_index_physical_stats (70, NULL, NULL, NULL, NULL)
With dm_db_index_physical_stats, specifying default, null or 0 uses the current database.
Sue
January 9, 2018 at 7:05 am
Sue_H - Tuesday, January 9, 2018 6:44 AMWith dm_db_index_physical_stats, specifying default, null or 0 uses the current database.
NULL, 0 or DEFAULT returns data for all databases on the instance.
https://docs.microsoft.com/en-us/sql/relational-databases/system-dynamic-management-views/sys-dm-db-index-physical-stats-transact-sql
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 9, 2018 at 7:20 am
GilaMonster - Tuesday, January 9, 2018 7:05 AMSue_H - Tuesday, January 9, 2018 6:44 AMWith dm_db_index_physical_stats, specifying default, null or 0 uses the current database.NULL, 0 or DEFAULT returns data for all databases on the instance.
https://docs.microsoft.com/en-us/sql/relational-databases/system-dynamic-management-views/sys-dm-db-index-physical-stats-transact-sql
I should have qualified - current database in that script. But it's just the join later that will limit that - as you previously mentioned.
Sorry didn't know why you referenced that at first or how its more efficient but now I get what you were saying - thanks.
Sue
January 9, 2018 at 7:23 am
January 9, 2018 at 7:34 am
Sue_H - Tuesday, January 9, 2018 7:20 AMGilaMonster - Tuesday, January 9, 2018 7:05 AMSue_H - Tuesday, January 9, 2018 6:44 AMWith dm_db_index_physical_stats, specifying default, null or 0 uses the current database.NULL, 0 or DEFAULT returns data for all databases on the instance.
https://docs.microsoft.com/en-us/sql/relational-databases/system-dynamic-management-views/sys-dm-db-index-physical-stats-transact-sqlI should have qualified - current database in that script. But it's just the join later that will limit that - as you previously mentioned.
Sorry didn't know why you referenced that at first or how its more efficient but now I get what you were saying - thanks.Sue
Sorry, should have been clearer in the initial comment.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 9, 2018 at 7:57 am
GilaMonster - Tuesday, January 9, 2018 7:34 AMSue_H - Tuesday, January 9, 2018 7:20 AMGilaMonster - Tuesday, January 9, 2018 7:05 AMSue_H - Tuesday, January 9, 2018 6:44 AMWith dm_db_index_physical_stats, specifying default, null or 0 uses the current database.NULL, 0 or DEFAULT returns data for all databases on the instance.
https://docs.microsoft.com/en-us/sql/relational-databases/system-dynamic-management-views/sys-dm-db-index-physical-stats-transact-sqlI should have qualified - current database in that script. But it's just the join later that will limit that - as you previously mentioned.
Sorry didn't know why you referenced that at first or how its more efficient but now I get what you were saying - thanks.Sue
Sorry, should have been clearer in the initial comment.
Not really....duh on me. But I'm in the states, it's early and the coffee is too weak. Brain just needed to be nudged.
January 10, 2018 at 12:26 am
Thanks for your query. May i know margin of each column? e.g: What is the margin of Fragmentation of each index? if exists what will happen? How to resolve this?
Manik
You cannot get to the top by sitting on your bottom.
Viewing 15 posts - 1 through 15 (of 17 total)
You must be logged in to reply to this topic. Login to reply