SQL Server Unused Index Script

  • yusufkahveci

    SSC-Addicted

    Points: 466

    Comments posted to this topic are about the item SQL Server Unused Index Script

    SQL Server Consultant
    yusufkahveci@sqlturkiye.com
    www.sqlturkiye.com

  • Sue_H

    SSC Guru

    Points: 90814

    yusufkahveci - Monday, January 15, 2018 12:37 PM

    Comments posted to this topic are about the item SQL Server Unused Index Script

    This script looks exactly the same as the script posted several years ago in Pinal Dave's blog on SQL Authority - I can't find any difference in formatting, alias names, the script itself, etc. Could you explain how this is different from his script located here:
    SQL SERVER – Unused Index Script – Download

    This is his script from his site:
    -- Unused Index Script
    -- Original Author: Pinal Dave
    SELECT TOP 25
    o.name AS ObjectName
    , i.name AS IndexName
    , i.index_id AS IndexID
    , dm_ius.user_seeks AS UserSeek
    , dm_ius.user_scans AS UserScans
    , dm_ius.user_lookups AS UserLookups
    , dm_ius.user_updates AS UserUpdates
    , p.TableRows
    , 'DROP INDEX ' + QUOTENAME(i.name)
    + ' ON ' + QUOTENAME(s.name) + '.'
    + QUOTENAME(OBJECT_NAME(dm_ius.OBJECT_ID)) AS 'drop statement'
    FROM sys.dm_db_index_usage_stats dm_ius
    INNER JOIN sys.indexes i ON i.index_id = dm_ius.index_id
    AND dm_ius.OBJECT_ID = i.OBJECT_ID
    INNER JOIN sys.objects o ON dm_ius.OBJECT_ID = o.OBJECT_ID
    INNER JOIN sys.schemas s ON o.schema_id = s.schema_id
    INNER JOIN (SELECT SUM(p.rows) TableRows, p.index_id, p.OBJECT_ID
    FROM sys.partitions p GROUP BY p.index_id, p.OBJECT_ID) p
    ON p.index_id = dm_ius.index_id AND dm_ius.OBJECT_ID = p.OBJECT_ID
    WHERE OBJECTPROPERTY(dm_ius.OBJECT_ID,'IsUserTable') = 1
    AND dm_ius.database_id = DB_ID()
    AND i.type_desc = 'nonclustered'
    AND i.is_primary_key = 0
    AND i.is_unique_constraint = 0
    ORDER BY (dm_ius.user_seeks + dm_ius.user_scans + dm_ius.user_lookups) ASC
    GO

  • Jeff Moden

    SSC Guru

    Points: 997320

    Agreed.  I've reported this as a "Terms of use" violation for possible plagiarism.  It explains a lot about several of this user's recent posts not having any decent information about what the scripts actually do.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".
    "Dear Lord... I'm a DBA so please give me patience because, if you give me strength, I'm going to need bail money too!"

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Sue_H

    SSC Guru

    Points: 90814

    Jeff Moden - Tuesday, January 16, 2018 11:41 AM

    Agreed.  I've reported this as a "Terms of use" violation for possible plagiarism.  It explains a lot about several of this user's recent posts not having any decent information about what the scripts actually do.

    Definitely explains a lot. Kind of like dropping sp_help_revloogin but not actually replacing it with a stored procedure with the same name 🙂
    That one had spk_hx which is exactly the same as sp_hexadecimal - but didn't drop that one.
    And spk_loginscript looks the same as sp_help_revloogin. The only changes I found were just adding comment blocks with his name, url and such in the middle of the scripts.

    Sue

  • Jeff Moden

    SSC Guru

    Points: 997320

    Sue_H - Tuesday, January 16, 2018 12:11 PM

    Jeff Moden - Tuesday, January 16, 2018 11:41 AM

    Agreed.  I've reported this as a "Terms of use" violation for possible plagiarism.  It explains a lot about several of this user's recent posts not having any decent information about what the scripts actually do.

    Definitely explains a lot. Kind of like dropping sp_help_revloogin but not actually replacing it with a stored procedure with the same name 🙂
    That one had spk_hx which is exactly the same as sp_hexadecimal - but didn't drop that one.
    And spk_loginscript looks the same as sp_help_revloogin. The only changes I found were just adding comment blocks with his name, url and such in the middle of the scripts.

    Sue

    Thanks for the verification, Sue.  I've taken this to the next step and have reported this user as a plagiarist  to abuse@sqlservercentral.com .  There is little so low in my book.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".
    "Dear Lord... I'm a DBA so please give me patience because, if you give me strength, I'm going to need bail money too!"

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Sue_H

    SSC Guru

    Points: 90814

    Jeff Moden - Wednesday, January 17, 2018 6:35 AM

    Thanks for the verification, Sue.  I've taken this to the next step and have reported this user as a plagiarist  to abuse@sqlservercentral.com .  There is little so low in my book.

    Thanks for posting the address - I saved it. I actually tried to answer this a few times but couldn't get one sentence typed without being beyond politically correct. So I guess you could say it irritates me more than a bit when people do that. A lot of people grab snippets here or there, forget where they got them, maybe does a quick post using it, etc but those are obvious and not a deliberate or conscious attempt to rip somebody off so they can look good. And I have to stop there before I have to delete this post again.

    Sue

  • ChrisM@Work

    SSC Guru

    Points: 186120

    This one  is also stolen. The entire introductory text has been lifted word for word from the original.
    It's on his LinkedIn too. What a B@$¬@~#.

    [font="Arial"]“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw[/font]


    For fast, accurate and documented assistance in answering your questions, please read this article[/url].
    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]
    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
    [url

  • Jeff Moden

    SSC Guru

    Points: 997320

    ChrisM@Work - Thursday, January 18, 2018 4:35 AM

    This one  is also stolen. The entire introductory text has been lifted word for word from the original.
    It's on his LinkedIn too. What a B@$¬@~#.

    Do you have a link for the original, Chris?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".
    "Dear Lord... I'm a DBA so please give me patience because, if you give me strength, I'm going to need bail money too!"

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • ChrisM@Work

    SSC Guru

    Points: 186120

    Jeff Moden - Thursday, January 18, 2018 5:34 AM

    ChrisM@Work - Thursday, January 18, 2018 4:35 AM

    This one  is also stolen. The entire introductory text has been lifted word for word from the original.
    It's on his LinkedIn too. What a B@$¬@~#.

    Do you have a link for the original, Chris?

    Sure.

    http://sqlserverplanet.com/dmvs/find-most-executed-stored-procedures

    [font="Arial"]“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw[/font]


    For fast, accurate and documented assistance in answering your questions, please read this article[/url].
    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]
    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
    [url

  • Jeff Moden

    SSC Guru

    Points: 997320

    Wow... this guy has no sense of right.  Considering that he also copied the text of an article, it proves that his plagiarism is blatant and deliberate.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".
    "Dear Lord... I'm a DBA so please give me patience because, if you give me strength, I'm going to need bail money too!"

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Sue_H

    SSC Guru

    Points: 90814

    Jeff Moden - Thursday, January 18, 2018 6:14 AM

    Wow... this guy has no sense of right.  Considering that he also copied the text of an article, it proves that his plagiarism is blatant and deliberate.

    And he uses other peoples work to claim he's an expert? And sadly, doesn't even know what some of the scripts he steals even do - some of those are really just basic SQL Server.
    Pathetic thief with no conscience.
    I knew he had stolen others but then when I saw Chris and John's posts to his other articles, I am starting to think he hasn't written any of the scripts from any of his articles. And it's been going on for years. What a total POS.

    Sue

  • Jeff Moden

    SSC Guru

    Points: 997320

    Sue_H - Thursday, January 18, 2018 7:01 AM

    Jeff Moden - Thursday, January 18, 2018 6:14 AM

    Wow... this guy has no sense of right.  Considering that he also copied the text of an article, it proves that his plagiarism is blatant and deliberate.

    And he uses other peoples work to claim he's an expert? And sadly, doesn't even know what some of the scripts he steals even do - some of those are really just basic SQL Server.
    Pathetic thief with no conscience.
    I knew he had stolen others but then when I saw Chris and John's posts to his other articles, I am starting to think he hasn't written any of the scripts from any of his articles. And it's been going on for years. What a total POS.

    Sue

    I've gotten no response from the "abuse" email I sent.  I'll wait another day (they're 5 hours ahead of me and might not have seen it yesterday) and then send an email to Steve.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".
    "Dear Lord... I'm a DBA so please give me patience because, if you give me strength, I'm going to need bail money too!"

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Steve Jones - SSC Editor

    SSC Guru

    Points: 721420

    I am removing these scripts from the site. There do appear to be a couple instances of plagiarism, though in others there is very little choice in how to gather the data. In any case, since I don't have time to research them all, I am removing them.

    My  apologies.

  • Jeff Moden

    SSC Guru

    Points: 997320

    Steve Jones - SSC Editor - Thursday, January 18, 2018 9:36 AM

    I am removing these scripts from the site. There do appear to be a couple instances of plagiarism, though in others there is very little choice in how to gather the data. In any case, since I don't have time to research them all, I am removing them.

    My  apologies.

    No need to apologize, Steve.  It's just not possible for even great editors like yourself to research every script that people post unless you have a large staff.  And, yes, I absolutely agree that there are only so many ways to write something but thank you for understanding that this fellow doesn't appear to be one of those, especially with copying even the introduction text.  My hat's off to you, good Sir!

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".
    "Dear Lord... I'm a DBA so please give me patience because, if you give me strength, I'm going to need bail money too!"

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Sue_H

    SSC Guru

    Points: 90814

    Steve Jones - SSC Editor - Thursday, January 18, 2018 9:36 AM

    I am removing these scripts from the site. There do appear to be a couple instances of plagiarism, though in others there is very little choice in how to gather the data. In any case, since I don't have time to research them all, I am removing them.

    My  apologies.

    Thanks for removing them - appreciate it very much.

    No way would you have time to read through all of them - all that matters now is that they are gone. Things like that happen and fortunately not that often up here.

    Sue

Viewing 15 posts - 1 through 15 (of 16 total)

You must be logged in to reply to this topic. Login to reply