0

Im student studying DB.. I was studying big physical three join operations(nested loop, sort merge, and hash join). and I dont know how index is used with the above joins..

here I have question..

what is index exactly...? is it just key? what is the data structure of it? is it the combination of address of real record and.. index attribute name or so?

I was to know the details about how index comes to usage as 'Key'.

As I know, clustered index is the matched one with real table ordering index.

and unclustered index is the one that would order the 'address pointers' of real matched columns of table.

and from the above,

then I`ve got to think like this..

then when we create table and designate one attribute as primary key, what is the effect of it?

the primary key becomes the default clustered index?? and physically the row data of the table is sorted by that primary key?

or the real order on disk is just the order when the row data were inserted? and primary key is just for relationship between tables not creating any effect like index?

then when we create clustered index, then the physical order on disk is reordered?

and HERE the thing I really couldn`t understand...

how is it said that "with index, it is much faster when we want to find data row that meets the specific predicate, because it is already sorted "

( I found that when I was studying about sort-merge join. the source says from each two table, if they have index, they don't need sorting phase and can merge directly..)

index makes the table sorted when we create index? I don`t know why it says index is like 'magical tool'..

thank you. I know I have written quite distractively, but I`m too confused and those are exactly the thoughts in my head...

  • and when it comes to sorted merge join,

in case they say 'from index table to real data table, it accesses by rowid', what does the ROWID mean? is it the different thing with Primary key or something????

thank you a lot...

*in case of Oracle,MySQL?

Swen
  • 79
  • 2
  • 3
  • 8
  • You haven't specified what DBMS you are referring to. Details of indexing and how indexes are used to execute queries really need to be explained in the context of particular software. Different products have different features. Please be more specific. – nvogel Dec 07 '12 at 11:42
  • sorry, I thought the mechanism would be the common attributes in all case. In case of Oracle and mySQL?? – Swen Dec 08 '12 at 00:33

2 Answers2

0

In relational Database primary key is default index .Suppose there are r1....to rn rows with C1.....to Cn columns in table T1 with primary key as P1 ,then P1 is default index.But,if you want to search C5 column of table T1,then if that column C5 is not indexed,then the searching algorithm searches every rows from r1...to rn with every columns C1 ....Cn.Let if time for search for single row is T1 ,then time to search single column of table =T1/Cn(approximate).But,when you index C5 column of table T1,then the execution order of search engine algorithm first searches primary key then the index key, so the access time of value of C5 is less than T1/Cn in respect to time.When to choose for indexing. case1:If within the columns of table T1 from C1 to Cn columns if the probrability of accessing rate of column value is higher for column CX for interval of time period p1...pn ,then CX is the first candidate for indexing and So on you can design for indexing for others.

abishkar bhattarai
  • 7,371
  • 8
  • 49
  • 66
  • primary key then the index key? then when it has extra index key, then one primary key for certain relation becomes like 'relation identifier?' or it is not even used when the index exists? :) – Swen Dec 08 '12 at 00:32
0

I think your questions are answers on my site:

In particular you should be interested in the following chapters:

But it might be best if you have a look a the full TOC:

Markus Winand
  • 8,371
  • 1
  • 35
  • 44