Page 1 of 3 123 LastLast
Results 1 to 15 of 32

Thread: Indexing

  1. #1
    Join Date
    Feb 2008
    Posts
    43

    Unanswered: Indexing

    Hi,

    Can you please help me find out if this statement is always true:

    "Adding a new Index slows down updates"

    This is more a general question, applicable as well for SQL Server.
    If this is not the appropriate subforum then I kindly ask an moderator to move this thread to the appropriate sub-forum.

    Thank you,
    Ronnyy

  2. #2
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    I would think this would only be true if you were updating a key of the index.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  3. #3
    Join Date
    Aug 2007
    Posts
    18
    It is going to be true, because the index page would have to be upgraded as well

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Quote Originally Posted by Dapo
    It is going to be true, because the index page would have to be upgraded as well
    Always? Are you sure?

    The answer actually is "no".

    A more complete answer is:
    • sometimes an index slows down updates
    • sometimes an index makes no difference to the speed of updates
    • sometimes an index speeds up updates
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Jul 2003
    Location
    Amsterdam, Nederland
    Posts
    450

    Totaly agree

    With .... pootle flump
    It all depends on size of table
    What are you indexing on (Number, varchar , GLOB)
    Greetz Marvels -^.^-
    Developments : VB4 Through .Net; Basic; DOS ; CNC ; Sinclair
    Databases : SQL Server Through 2005; Access 3 Through 2003 ; Oracle 8 & 9.i ;
    OS : Win 3.11 Through XP ; NortonComander ; DOS

  6. #6
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Like "Every time you jump, the Earth shifts", it is true, but usually insignificant.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  7. #7
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    It may be insignificant until you get to be as fat as I am.

    As part of my ASBO campaign, I'm walking in front of traffic on a regular basis. The outcome of a collision is determined by mass and structural strength, and I outweigh conventional vehicles by a large enough margin that the structural strength issue never comes into play. This may be due in part to my olfactory strength, which I think overcomes the vehicle's structural strength before impact.

    -PatP

  8. #8
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Quote Originally Posted by Marvels
    It all depends on size of table
    Whether there are 3 columns or 3 hundred columns, 3 rows or 300 million rows, the table takes up 3 MB or 300TB, the answer still stands
    Testimonial:
    pootle flump
    ur codings are working excelent.

  9. #9
    Join Date
    Sep 2005
    Posts
    161
    I have to agree with pootle flump, and expand.

    We would need more information about your database to give you a better answer. It's a case by case scenario. If your table is small, it won't matter. Is the index in question a clustered index? What kind of selectivity do you expect for the index? Is it an identity column? Will the value of the index ever change? Are there any constraints enforced on the indexed column? Etc....

  10. #10
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Slows down updates?

    Maybe

    Slows down Inserts?

    Yes
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  11. #11
    Join Date
    Jul 2003
    Location
    Amsterdam, Nederland
    Posts
    450

    hmmm

    Quote Originally Posted by Brett Kaiser

    Slows down Inserts?

    Yes
    I disagree (a bit) with that.

    Could allso speed it up,
    As triggers and/or storedproc that update a table that depends on data of an other table that has an index, would speed up the update/insert.

    It's just how you look at it

    And again it depends on the size of your db if you have 30Bilj recs or 300
    with the 300 it will slow down on the inserted table but you won't notice it.

    if it comes to 30biljon records you will notice the insert,
    but if you want a selection you will be gladd that you have a index in it
    Greetz Marvels -^.^-
    Developments : VB4 Through .Net; Basic; DOS ; CNC ; Sinclair
    Databases : SQL Server Through 2005; Access 3 Through 2003 ; Oracle 8 & 9.i ;
    OS : Win 3.11 Through XP ; NortonComander ; DOS

  12. #12
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322

    ummmmmmmmmmm

    did you say something?
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  13. #13
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Quote Originally Posted by Brett Kaiser
    Slows down Inserts?

    Yes
    Doooooood - we've covered this one. Remember - you even contacted Mr Randall privately to bring him into the discussion.

    Indexes can even speed up inserts *


    *One particular type of index anyway.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  14. #14
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Quote Originally Posted by Marvels
    And again it depends on the size of your db if you have 30Bilj recs or 300
    with the 300 it will slow down on the inserted table but you won't notice it.
    Size doesn't make a difference (and I for one am eternally grateful about that but we will leave that little topic for another day). I'm not considering perceptible difference - I'm talking about measuring speed in terms of the number of pages SQL Server needs to read from and write to in order to satisfy a data modification query. Whether or not the data is in the cache already will affect the time taken but we can't account for that. I'm only accounting for what can be accounted for. If ya knowz what I meanz
    Testimonial:
    pootle flump
    ur codings are working excelent.

  15. #15
    Join Date
    Jul 2003
    Location
    Amsterdam, Nederland
    Posts
    450

    Copy / insert

    Im not talking about an insert of 1 rec but X-folds

    take a table that has no index and insert it into a table with index
    With
    300 recs
    you'll be doíng it at speed of 0.0003 sec a record

    if your at 3bill. A rec will take allmost 1 sec, you can allmost follow the insert manualy.
    Why do you think if you have a big table and you copy/back it up, its better to first take off the index and later set it back again.
    Greetz Marvels -^.^-
    Developments : VB4 Through .Net; Basic; DOS ; CNC ; Sinclair
    Databases : SQL Server Through 2005; Access 3 Through 2003 ; Oracle 8 & 9.i ;
    OS : Win 3.11 Through XP ; NortonComander ; DOS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •