1

Going through this answer for a stack-overflow question, I found a fact that

In The physical structure of InnoDB index pages I describe the Last Insert Position, Page Direction, and Number of Inserts in Page Direction fields of each index page. This is how the tracking for ascending vs. descending order is done (as left vs. right, though). With each insert, the last inserted record is compared to the currently inserted one, and if the insert is in the same "direction", the counter is incremented. This counter is then checked to determine the page split behavior; whether to split in half or create a new, empty page

It is understood that page split up is based on Number of Inserts in Page Direction

But , I wonder whether there will be threshold for "Number of Inserts in Page Direction" to initiate page split up? Any particular logic behind setting "Page Direction" flag?

I am curious in getting these concepts with a working example with asap details!!! All efforts welcome.

  • A guess: Case 1: Random inserts --> split when page full. Case 2: inserting at 'end' (think auto_increment): --> don't "split", start a new block. The "Direction" may be a heuristic to handle other cases in an attempt to minimize splitting. – Rick James Oct 25 '18 at 21:53
1

The author is talking about PAGE_N_DIRECTION. This has nothing to do with triggering splitting, which is performed by page_dir_split_slot. Splitting/merging is determined by a MIN and MAX on the directory slot

/* The maximum and minimum number of records owned by a directory slot. The
number may drop below the minimum in the first and the last slot in the
directory. */
#define PAGE_DIR_SLOT_MAX_N_OWNED 8
#define PAGE_DIR_SLOT_MIN_N_OWNED 4

You don't split when you fall under MIN, you merge (via page_dir_balance_slot).

PAGE_N_DIRECTION is for an optimization,

Try a search shortcut based on the last insert.

  • @DineshKumar Not sure dates back to the inno days, you'd have to understand what PAGE_CUR_ADAPT is doing. That's a whole different question. – Evan Carroll Oct 24 '18 at 19:24
  • 1
    will do that ... – Dinesh Kumar Oct 25 '18 at 5:29
  • can I measure no of page splits during a insert/update query? Especially separate count for two type of page splits i.e., new page creation / splitting of existing page – Dinesh Kumar Nov 19 '18 at 7:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.