From: Paul Wilson Date: February 21 2013 4:36am Subject: Re: a doubt about page directory List-Archive: http://lists.mysql.com/innodb/72 Message-Id: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b621f2a005c1804d634a102 --047d7b621f2a005c1804d634a102 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable UNSUBSCRIBE On Wed, Feb 20, 2013 at 10:25 PM, Lixun Peng wrote: > Hi Bohu, > > I think your understanding about Page Directory is wrong. > > In one page, the records usually are ordered in physical, Page Directory > records some rows' offset. > So if you have these rows in a page: > [Infimum, offset:99]->[Supremum, offset:112]->[Key:0, offset 125]->...two > rows...->[Key:3, offset: 221]->...three rows..->[Key:7, offset: 349] > Then you maybe see these offsets in Page Directory: > [99, 221, 349, 112] > > Why InnoDB need to use the page directory for speed up searching one row = in > a page? > I think it can save parsing time, if no page directory, InnoDB need to > parse entire page, and parse each rows one by one, and then you can find > the row you need. > But if has page directory, we can use these offsets to skip some rows, fo= r > example. we need to search Key=3D7, so we can go to offset 99, it's not K= ey > 7, and then we go to offset 221, it's not Key 7, too. > Next, we go to 349, it's Key 7, it's the row I need. > > That's the page directory used for. > > Thanks, > Lixun > > > On Thu, Feb 21, 2013 at 11:42 AM, Bohu TANG >wrote: > > > Hello, > > > > I know the directory page is designed to faster read using binary searc= h, > > since the records of one page is unordered(in physical). > > With the purpose of binary search, we also can do it in the same page: > > 1) When you do first search in a page, we overwrite the page with the > > ordered list(because one page is 16KB or others, but it=92s very small,= and > > close to the disk transfer block in modern) > > 2) The second time you search it you can do binary search internal thi= s > > page, so do not need the page directory. > > > > Why not it? > > > > Thanks > > --- > > BohuTANG > > > > "The great artist is the simplifier."--- *Vincent Van Gogh* > > > > > > -- > Senior MySQL Developer @ Taobao.com > > Mobile Phone: +86 18658156856 (Hangzhou) > Gtalk: penglixun(at)gmail.com > Twitter: http://www.twitter.com/plinux > Blog: http://www.penglixun.com > --047d7b621f2a005c1804d634a102--