SQL help..

JVG

Active member
  • Apr 23, 2009
    377
    25
    28
    clustered waladi machan index eke piliwelatama thamayi data rows tikak thiyenne. Just like normal primary keys in a table.

    Non clustered waladi wenama table ekak wage ekak use wenawa. eken kerenne pointers thiyaganna eka. Non clustered wala index ekai, physical row ekakui set wenne pointer ekak haraha.

    clusteres waladi umbata 6th row eka thiyaganna puluwan 6th index ekemai. eth umbata 6th row eka 4th index eke thiyaganna puluwan non clusteres waladi. e ekedi pointer table ekak use wena nisa. pointer table eke umbata define karanna puluwan 4th index eka point wenne 6th row ekata kiyala.

    (mamath machan meka gena denagena hitiye ne. dan net eke search karala balagaththe.)
     
    • Like
    Reactions: Juni@r

    ♥-Aurora-♥

    Well-known member
  • Jun 5, 2010
    4,309
    942
    113
    index එකක් හැදුවම කොටස් 2ක් තියෙනවනෙ, key & data කියලා. clustered වලදි වෙන්නෙ මේ දෙකම තියෙන්නෙ එකම විදියට sort වෙලා.
    eg:
    Code:
      [COLOR="DarkRed"]2                  2 aaa[/COLOR]
      [COLOR="Red"]3                  3 bbb[/COLOR]
      [COLOR="Magenta"]4                  4 ccc[/COLOR]
      [COLOR="Blue"]5                  5 ddd[/COLOR]

    non clustered වලදි sort වෙන්නෙ key හෙවත් index එක විතරයි.
    eg:
    Code:
      [COLOR="DarkRed"]2[/COLOR]                  [COLOR="Blue"]5 ddd[/COLOR]
      [COLOR="Red"]3[/COLOR]                  [COLOR="DarkRed"]2 aaa[/COLOR]
      [COLOR="Magenta"]4[/COLOR]                  [COLOR="Red"]3 bbb[/COLOR]
      [COLOR="Blue"]5[/COLOR]                  [COLOR="Magenta"]4 ccc[/COLOR]

    key field එක අනිවාර්යෙන් sorted. නැත්තම් index එකක් නෙවිනෙ.
    ටේබල් එකකට clustered index 1යි නෙ තියෙන්න පුලුවන්. එතකොට ඒකට අනුව data ටික sort වෙනවා. non-clustered indexes හදද්දි data වලට මුකුත් වෙන්නෙ නෑ. index එකක් create වෙනවා විතරයි.

    මේ පින්තූරෙත් පොඩ්ඩක් බලන්න..
    මේකෙ non-clustered index එක අරන් තියෙන්නෙ last name එකෙන්.


    ch11fig7.gif


    තවත් තේරුන් නැත්තම් අහන්න.. ;)
     
    • Like
    Reactions: Juni@r

    Juni@r

    Member
    May 18, 2012
    370
    22
    0
    clustered waladi machan index eke piliwelatama thamayi data rows tikak thiyenne. Just like normal primary keys in a table.

    Non clustered waladi wenama table ekak wage ekak use wenawa. eken kerenne pointers thiyaganna eka. Non clustered wala index ekai, physical row ekakui set wenne pointer ekak haraha.

    clusteres waladi umbata 6th row eka thiyaganna puluwan 6th index ekemai. eth umbata 6th row eka 4th index eke thiyaganna puluwan non clusteres waladi. e ekedi pointer table ekak use wena nisa. pointer table eke umbata define karanna puluwan 4th index eka point wenne 6th row ekata kiyala.

    (mamath machan meka gena denagena hitiye ne. dan net eke search karala balagaththe.)

    ♥-Aurora-♥;14162545 said:
    index එකක් හැදුවම කොටස් 2ක් තියෙනවනෙ, key & data කියලා. clustered වලදි වෙන්නෙ මේ දෙකම තියෙන්නෙ එකම විදියට sort වෙලා.
    eg:
    Code:
      [COLOR=DarkRed]2                  2 aaa[/COLOR]
      [COLOR=Red]3                  3 bbb[/COLOR]
      [COLOR=Magenta]4                  4 ccc[/COLOR]
      [COLOR=Blue]5                  5 ddd[/COLOR]
    non clustered වලදි sort වෙන්නෙ key හෙවත් index එක විතරයි.
    eg:
    Code:
      [COLOR=DarkRed]2[/COLOR]                  [COLOR=Blue]5 ddd[/COLOR]
      [COLOR=Red]3[/COLOR]                  [COLOR=DarkRed]2 aaa[/COLOR]
      [COLOR=Magenta]4[/COLOR]                  [COLOR=Red]3 bbb[/COLOR]
      [COLOR=Blue]5[/COLOR]                  [COLOR=Magenta]4 ccc[/COLOR]
    key field එක අනිවාර්යෙන් sorted. නැත්තම් index එකක් නෙවිනෙ.
    ටේබල් එකකට clustered index 1යි නෙ තියෙන්න පුලුවන්. එතකොට ඒකට අනුව data ටික sort වෙනවා. non-clustered indexes හදද්දි data වලට මුකුත් වෙන්නෙ නෑ. index එකක් create වෙනවා විතරයි.

    මේ පින්තූරෙත් පොඩ්ඩක් බලන්න..
    මේකෙ non-clustered index එක අරන් තියෙන්නෙ last name එකෙන්.


    ch11fig7.gif


    තවත් තේරුන් නැත්තම් අහන්න.. ;)

    ela dennatama godak sthuthi machan la..elatama therunaaa