Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. clustered index more than on one field

clustered index more than on one field

Scheduled Pinned Locked Moved Database
databasequestiongame-devperformancediscussion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MecAlex
    wrote on last edited by
    #1

    Has someone experience applying clustered index more than on one field? I think it is wrong action. May be it could work with small database. My observation showed such estimation: same table same number of records. Execution query to select all fields from same table without having clustered index on single column is 8sec (650243). In other case I have apply clustered index on primary and foreign keys. Execution last about 12 sec.; basically it decreased performance. So now is a question: if I can apply non clustered index on couple fields, what is the best practice to apply clustered index. Whether it should be only single field to sort data in a table? :confused:

    We live in a Newtonian world of Einsteinian physics ruled by Frankenstein logic

    _ 1 Reply Last reply
    0
    • M MecAlex

      Has someone experience applying clustered index more than on one field? I think it is wrong action. May be it could work with small database. My observation showed such estimation: same table same number of records. Execution query to select all fields from same table without having clustered index on single column is 8sec (650243). In other case I have apply clustered index on primary and foreign keys. Execution last about 12 sec.; basically it decreased performance. So now is a question: if I can apply non clustered index on couple fields, what is the best practice to apply clustered index. Whether it should be only single field to sort data in a table? :confused:

      We live in a Newtonian world of Einsteinian physics ruled by Frankenstein logic

      _ Offline
      _ Offline
      _Damian S_
      wrote on last edited by
      #2

      By definition, there can only ever be a single clustered index on a table - it is the clustered index that sets the physical order of records. Usually, the clustered index would be on a single field, and generally that will be a key field that auto-numbers. The performance hit for clustered indices is more related to inserts and updates on your data, as if you insert/update a record that is towards the start of the index, and make it fall towards the end, nearly the whole table is physically reordered on the disk to accomodate this.

      Reminiscing just isn't what it used to be!! Booger Mobile - My bright green 1964 Ford Falcon - check out the blog here!! | If you feel generous - make a donation to Camp Quality!!

      M 1 Reply Last reply
      0
      • _ _Damian S_

        By definition, there can only ever be a single clustered index on a table - it is the clustered index that sets the physical order of records. Usually, the clustered index would be on a single field, and generally that will be a key field that auto-numbers. The performance hit for clustered indices is more related to inserts and updates on your data, as if you insert/update a record that is towards the start of the index, and make it fall towards the end, nearly the whole table is physically reordered on the disk to accomodate this.

        Reminiscing just isn't what it used to be!! Booger Mobile - My bright green 1964 Ford Falcon - check out the blog here!! | If you feel generous - make a donation to Camp Quality!!

        M Offline
        M Offline
        MecAlex
        wrote on last edited by
        #3

        Thank you. You confirmed my thoughts.

        We live in a Newtonian world of Einsteinian physics ruled by Frankenstein logic

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups