在PostgreSQL中查找一行的字节大小 [英] Find the byte size of a row in PostgreSQL

查看:1127
本文介绍了在PostgreSQL中查找一行的字节大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我在PostgreSQL中有一个表,我如何找到系统使用的确切的字节大小,以保存我的表的特定行?

Assuming I have a table in PostgreSQL, how can I find the exact byte size used by the system in order to save a specific row of my table?

例如,假设我有一个带有 VARCHAR(1000000)字段的表,一些行包含真正大的字符串,而其他行真的很小。在这种情况下,如何检查行的字节大小? (包括字节大小,即使在使用 TOAST 的情况下) )。

For example, assume I have a table with a VARCHAR(1000000) field and some rows contain really big strings for this field while others really small. How can I check the byte size of a row in this case? (including the byte size even in the case TOAST is being used).

推荐答案

使用 pg_column_size octet_length

请参阅:

  • How can pg_column_size be smaller than octet_length?
  • How can I find out how big a large TEXT field is in Postgres?
  • How can pg_column_size be smaller than octet_length?

这篇关于在PostgreSQL中查找一行的字节大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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