• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Why doesn’t innodb store row pointer in secondary/non-clustered index?

Resolved: Why doesn’t innodb store row pointer in secondary/non-clustered index?

0
By Isaac Tonny on 04/04/2023 Issue
Share
Facebook Twitter LinkedIn

In this post, we will see how to resolve Why doesn’t innodb store row pointer in secondary/non-clustered index?

Question:

As we know, innodb stores only primary key value in its secondary index, which means we need to traverse the clustered index B+ tree again to fetch the row record.
Why not just store the row pointer in secondary index to reduce the extra finding work?

Best Answer:

There is no “row pointer”. The columns of the PRMARY KEY serve the function of locating the row — in the data’s BTree.
Sure, looking up via the PK is arguably slower than a “row pointer”. But Updates, Deletes, block splits, etc., automatically handled. (Cf Bill’s Comment.) This keeps the code simpler. And, in some situations, faster.
A trivial example of faster: Given
In this example, the index’s BTree has the complete answer; no need to reach into the data’s BTree. Hence, the index is called “covering” for this SELECT.

If you have better answer, please add a comment about this, thank you!

Source: Stackoverflow.com

innodb mysql non-clustered-index
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: How to stop a thread that has a blocking function from easygui in python

05/04/2023

Resolved: Removing null keys from a json array of objects

05/04/2023

Resolved: How can I generate at compile-time a separate OpenAPI Swagger.json file for each Controller in my ASP.NET project?

05/04/2023

Comments are closed.

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.