0

I have a question regarding this answer.
I also posted this question as a comment to that answer, but didn't get any response.

It states that in the case of indexing on a non-key field, the schema would be:

Field name       Data type      Size on disk
firstName        Char(50)       50 bytes
(record pointer) Special        4 bytes

My question is that why is there a need to store firstName again? Isn't the pointer enough? We'll just have to simply change the sorting comparison function to compare on (*pointer).firstName, rather than firstName.

Community
  • 1
  • 1
Anmol Singh Jaggi
  • 8,376
  • 4
  • 36
  • 77

1 Answers1

0

Quoting the answer given as a comment by @wildplasser :

In theory, it is not needed: the char(50) field could be pulled from the basetable. In practice, this would cause both the basetable and the index to be pulled fron disk, costing more IO bandwith and bufferspace.

Community
  • 1
  • 1
Anmol Singh Jaggi
  • 8,376
  • 4
  • 36
  • 77