简体   繁体   中英

Accessing the mySQL B-tree from C++

Trees are allocated in the Heap. Hence, there should be a pointer to the root node.

If mySQL takes indexed rows, identifed by the Primary Key and stores them in a B - Tree, is there a way I can access the B-Tree via a C++ interface?

This is part of a learning process, I'm curious, if I can somehow access the root pointer for the B-Tree of a particular table?

The indexes are stored in disk, and are not necessarily resident in memory. If they were in memory, that would be mysqld 's memory, not your application's. If you want to peruse the indexes yourself, go ahead and open the files--ideally using some of the existing (open-source, of course) MySQL storage engine code.

Your question seems to show a confusion (unless you work on extending MySQL , which you didn't say, so I suppose you are not extending MySQL - if you did you would have asked a different question.).

mysql is (almost always) used as a server program. Your sysadmin is configuring it, and provides you with the ability to interact with that server (often, thru TCP/IP sockets and using a not-enough documented protocol).

As a naive user or developer, you just send requests to the MySQL server, and you get responses from it. So you don't care about B-tree inside the memory of the mysql process, because your only way of interacting with MySQL is thru the network connection to it with requests and responses.

Or perhaps I misunderstood your question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM