Avg_row_length是怎么计算的?

本文介绍如何使用MySQL命令查询表的状态信息,并重点解释了Avg_row_length字段的计算方式及其背后的技术原理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

通过一下命令我们可以获取表的使用情况:

root@mysql 05:49:33>show table status like 'tbname'\G

结果:

*************************** 1. row ***************************
           Name: tbname
         Engine: InnoDB
        Version: 10
     Row_format: Compact
           Rows: 3425
 Avg_row_length: 138
    Data_length: 475136
Max_data_length: 0
   Index_length: 1572864
      Data_free: 3145728
 Auto_increment: 6894011508
    Create_time: 2016-10-12 15:03:25
    Update_time: NULL
     Check_time: NULL
      Collation: utf8mb4_general_ci
       Checksum: NULL
 Create_options:
        Comment: NULL
1 row in set (0.00 sec)
Avg_row_length顾名思义是平均每行的长度,那么这个值是怎么获得的?
1. 因为InnoDB的行数是一个近似值 
2. 平均每行长度=数据大小/行数 
3. 大部分都是超过了每行的长度,因为在InnoDB的老版本中为了页对齐都自动的往上增加了,比如有一行行长29 bytes为了保证页对齐,往上加了1或2个bytes。 
4. 在经历了多次块分裂后, 认为块到达约69%的就满了 
参考资料:
http://forums.mysql.com/read.php?22,219129,224296#msg-224296

转载于:https://www.cnblogs.com/sunss/p/6122997.html

#### 最开始的热图 library(pheatmap) library(dplyr) df <- read.csv("scMetabolism_RESULTS/scMetabolism.csv", row.names=1, check.names=F) avg_df =aggregate(df[,1:ncol(df)-1],list(df$orig.ident),mean) rownames(avg_df) = avg_df$Group.1 avg_df=avg_df[,-1] avg_df <- as.data.frame(t(avg_df)) data <- avg_df kegg_inf <- read.csv("/disk221/lihx/SOFTware/KEGG/KEGG_map.csv", row.names=1, check.names=FALSE) metabolism_inf <- read.csv("scMetabolism_RESULTS/scMetabolism.matrix.csv", header = TRUE, check.names = FALSE) colnames(metabolism_inf) <- c("KEGG","RF_S2", "RF_S1", "SF_S2", "SF_S1") metabolism_inf <- inner_join(metabolism_inf,kegg_inf[,c(1,4)],by=c("KEGG"="KEGG")) annotation_row <- data.frame(Category=metabolism_inf$second_category) rownames(annotation_row) <- metabolism_inf$KEGG annotation_col <- data.frame(STRAIN=sapply(strsplit(colnames(data), "-"), function(x) x[1])) rownames(annotation_col) <- colnames(data) ann_colors=list(STRAIN=c('RF_S1'='#2A9D8F','RF_S2'='#E76F51','SF_S1'='#2A9D56','SF_S2'='#F4A261')) pheatmap(data, scale="row", annotation_colors=ann_colors, # annotation_col=annotation_col, annotation_row=annotation_row, show_rownames=T, show_colnames=T, cluster_rows=F, cluster_cols=F, # color = colorRampPalette(c("#1A5592",'white',"#B83D3D"))(100), color=colorRampPalette(c("navy",'white',"firebrick3"))(50), filename="scMetabolism_RESULTS/pheatmap.pdf", width=12, height=12) 请问这段代码哪里有问题?为什么会出现错误 Error in check.length("fill"): 'gpar' element 'fill' must not be length 0 Traceback: 1. heatmap_motor(mat, border_color = border_color, cellwidth = cellwidth, . cellheight = cellheight, treeheight_col = treeheight_col, . treeheight_row = treeheight_row, tree_col = tree_col, tree_row = tree_row, . filename = filename, width = width, height = height, breaks = breaks, . color = color, legend = legend, annotation_row = annotation_row, . annotation_col = annotation_col, annotation_colors = annotation_colors, . annotation_legend = annotation_legend, annotation_names_row = annotation_names_row, . annotation_names_col = annotation_names_col, main = main, . fontsize = fontsize, fontsize_row = fontsize_row, fontsize_col = fontsize_col, . hjust_col = hjust_col, vjust_col = vjust_col, angle_col = angle_col, . fmat = fmat, fontsize_number = fontsize_number, number_color = number_color, . gaps_row = gaps_row, gaps_col = gaps_col, labels_row = labels_row, . labels_col = labels_col, ...) 2. heatmap_motor(matrix, cellwidth = cellwidth, cellheight = cellheight, . border_color = border_color, tree_col = tree_col, tree_row = tree_row, . treeheight_col = treeheight_col, treeheight_row = treeheight_row, . breaks = breaks, color = color, legend = legend, annotation_col = annotation_col, . annotation_row = annotation_row, annotation_colors = annotation_colors, . annotation_legend = annotation_legend, annotation_names_row = annotation_names_row, . annotation_names_col = annotation_names_col, filename = NA, . main = main, fontsize = fontsize, fontsize_row = fontsize_row, . fontsize_col = fontsize_col, hjust_col = hjust_col, vjust_col = vjust_col, . angle_col = angle_col, fmat = fmat, fontsize_number = fontsize_number, . number_color = number_color, labels_row = labels_row, labels_col = labels_col, . gaps_col = gaps_col, gaps_row = gaps_row, ...) 3. draw_annotation_legend(annotation, annotation_colors, border_color, . fontsize = fontsize, ...) 4. rectGrob(x = unit(0, "npc"), y = yy, hjust = 0, vjust = 1, height = 2 * . text_height, width = 2 * text_height, gp = gpar(col = border_color, . fill = annotation_colors[[i]])) 5. grob(x = x, y = y, width = width, height = height, just = just, . hjust = hjust, vjust = vjust, name = name, gp = gp, vp = vp, . cl = "rect") 6. gpar(col = border_color, fill = annotation_colors[[i]]) 7. validGP(list(...)) 8. check.length("fill") 9. stop(gettextf("'gpar' element '%s' must not be length 0", gparname), . domain = NA) 10. .handleSimpleError(function (cnd) . { . watcher$capture_plot_and_output() . cnd <- sanitize_call(cnd) . watcher$push(cnd) . switch(on_error, continue = invokeRestart("eval_continue"), . stop = invokeRestart("eval_stop"), error = NULL) . }, "'gpar' element 'fill' must not be length 0", base::quote(check.length("fill")))
最新发布
06-29
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值