s*i 发帖数: 31 | 1 What is the difference between "store the records in a file organized as an
index on attribute A." and "sorting the file by attribute A".
Let's say we have a table of 5 records of (age,salary).
(25,50000) (30,60000) (35, 70000) (40,80000) (50,90000)
What is the result of indexing this table on age VS sorting this table on
age? Both are techniques used by DBMS right?
Tell me what is the difference between the 2 techniques? | c*****t 发帖数: 1879 | 2 Index is automatically used by the query engine while explicitly
specifying sorting is done by the user who does the query.
Usually, when index is used, tuples are retrieved in the order
they appear in the index, so they are sort in a way, although
may not be in the order wanted by the user.
When user explicitly specify the query order, if there is no
such index for the column, in memory sorting is performed before
result is returned.
an
【在 s*i 的大作中提到】 : What is the difference between "store the records in a file organized as an : index on attribute A." and "sorting the file by attribute A". : Let's say we have a table of 5 records of (age,salary). : (25,50000) (30,60000) (35, 70000) (40,80000) (50,90000) : What is the result of indexing this table on age VS sorting this table on : age? Both are techniques used by DBMS right? : Tell me what is the difference between the 2 techniques?
| s*i 发帖数: 31 | 3 How does database perform indexing? Does it need to create another file, and
what does it put in the 2nd file?
【在 c*****t 的大作中提到】 : Index is automatically used by the query engine while explicitly : specifying sorting is done by the user who does the query. : Usually, when index is used, tuples are retrieved in the order : they appear in the index, so they are sort in a way, although : may not be in the order wanted by the user. : When user explicitly specify the query order, if there is no : such index for the column, in memory sorting is performed before : result is returned. : : an
| c*****t 发帖数: 1879 | 4 It depends.
For primary clustering index, there isn't a need of a separate index
file since the records are already in that order.
PostreSQL doesn't use primary clustering index, so all indexes are
secondary.
The details of how indexes are stored are also implementation specific.
For example, there are hash, b+ tree, r-tree, gist indexing etc. Some
implementation basically treat index entries as another relational
table.
Typically, the entire value of the column(s), or the result coming
from ev
【在 s*i 的大作中提到】 : How does database perform indexing? Does it need to create another file, and : what does it put in the 2nd file?
|
|