检查单行占用多少空间SQLite中空间、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...

有没有一种方法来检查单行占用多少空间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.

阅读全文

相关推荐

最新文章