摘要:
再次回到 estimate_rel_size 我发现,在入口参数 rel中,rel->rd_rel->reltuples 的值已经完全准备好了:/* * estimate_rel_size - estimate # pages and # tuples in a table or index * * We also estimate the fraction of the pages that are marked all-visible in * the visibility map, for use in estimation of index-only scans. * * 阅读全文
摘要:
接前面。回到程序调用关系上来:estimate_rel_size -> RelationGetNumberOfBlocks->RelationGetNumberOfBlocksINFork->Smgrnblocks->mdnblocks...折腾了一圈,就是为了评估一个表的大小。那么,我们所获得的block,它到底是个什么单位?BlockNumbermdnblocks(SMgrRelation reln, ForkNumber forknum){ MdfdVec *v = mdopen(reln, forknum, EXTENSION_FAIL); BlockNumbe 阅读全文
摘要:
接前面:回到mdopen上来,看看是谁调用了 mdopen,又获得了什么。/* * mdnblocks() -- Get the number of blocks stored in a relation. * * Important side effect: all active segments of the relation are opened * and added to the mdfd_chain list. If this routine has not been * called, then only segments up ... 阅读全文