Please enable JavaScript.
Coggle requires JavaScript to display documents.
Indexing, Secondary Index, Indexing, Primary Index, Tight Binding VS Bind…
-
Secondary Index
Delete Record
-
-
Alternatives
-
-
If the primary index of deleted record is not available, then it's deleted.
-
-
-
Update Record
3 Cases
-
-
Update other fields
-
Otherwise
-
Update the offset of the newly inserted record in PK index (No need to reorder the primary index file.)
-
Waste space due to duplicates,
Solution
use array to store the primary keys that are related to a secondary key (only one instance of the secondary key)
-
-
-
-
-
-
-
-
-
Indexing
-
-
-
-
Allows files to be organized without re-arranging original files Records appear in data file in the same order they entered.
-
-
To persist an index, write the content of an index to a file.
-
-
Primary Index
-
Insert Record
- Insert record to both files
- Re-arrange index file content (sort the file in-memory) and re-write it on disk
-
-
Delete Record
- In datafile: Use techniques for reclaiming space in files
-
Search Record
- Use Binary Search in memory in the index and return the reference field (byte_offset)
- Open the original file and seek to the record by byte_offset.
-
-
Direct binding to the datafile (When constructing the file, the primary index is bind to it.)
-