检查单行占用多少空间SQLite中 [英] Check how much space a single row takes in Sqlite

查看:104
本文介绍了检查单行占用多少空间SQLite中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法来检查单行占用多少空间SQLite中?

Is there a way to check how much space a single row takes in Sqlite?

我一直在使用这样的尝试:

I have tried using this way:

我有4场在我的表:

id(int)
name(text)
pat(text)
is_default(bool) 

 select *, sum(length(id)+length(name)+length(pat)+length(is_default)) 
    from color;

但它返回字符长度(例如:43)。我怎么能确定字节行长度?

But it returns character length (for example: 43). How can I determine the row length in bytes?

推荐答案

SQLite的本身不会给你这个信息,但是的 SQLite的分析仪工具一样。

SQLite itself does not give you this information, but the sqlite-analyzer tool does.

如果您想从您的应用程序做到这一点,你必须阅读所有的记录值,并从这些推断多少字节中的磁盘上记录格式

If you want to do this from your app, you have to read all the record values and from those deduce how many bytes are used in the on-disk record format.

这篇关于检查单行占用多少空间SQLite中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆